Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / navigation_details.h
blob19c852d2b141f46e4e355da77630de7068fe6a2e
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_
8 #include <string>
9 #include "content/common/content_export.h"
10 #include "content/public/browser/navigation_type.h"
11 #include "content/public/common/ssl_status.h"
12 #include "url/gurl.h"
14 namespace content {
16 class NavigationEntry;
18 // Provides the details for a NOTIFICATION_NAV_ENTRY_COMMITTED notification.
19 // TODO(brettw) this mostly duplicates ProvisionalLoadDetails, it would be
20 // nice to unify these somehow.
21 struct CONTENT_EXPORT LoadCommittedDetails {
22 // By default, the entry will be filled according to a new main frame
23 // navigation.
24 LoadCommittedDetails();
26 // The committed entry. This will be the active entry in the controller.
27 NavigationEntry* entry;
29 // The type of navigation that just occurred. Note that not all types of
30 // navigations in the enum are valid here, since some of them don't actually
31 // cause a "commit" and won't generate this notification.
32 content::NavigationType type;
34 // The index of the previously committed navigation entry. This will be -1
35 // if there are no previous entries.
36 int previous_entry_index;
38 // The previous URL that the user was on. This may be empty if none.
39 GURL previous_url;
41 // True if the committed entry has replaced the exisiting one.
42 // A non-user initiated redirect causes such replacement.
43 bool did_replace_entry;
45 // True if the navigation was in-page. This means that the active entry's
46 // URL and the |previous_url| are the same except for reference fragments.
47 bool is_in_page;
49 // True when the main frame was navigated. False means the navigation was a
50 // sub-frame.
51 bool is_main_frame;
53 // When the committed load is a web page from the renderer, this contains
54 // the security state if the page is secure.
55 // See FrameHostMsg_DidCommitProvisionalLoad_Params.security_info, where it
56 // comes from, after being deserialized with
57 // SSLManager::DeserializeSecurityInfo.
58 SSLStatus ssl_status;
60 // Returns whether the main frame navigated to a different page (e.g., not
61 // scrolling to a fragment inside the current page). We often need this logic
62 // for showing or hiding something.
63 bool is_navigation_to_different_page() const {
64 return is_main_frame && !is_in_page;
67 // The HTTP status code for this entry..
68 int http_status_code;
71 // Provides the details for a NOTIFICATION_NAV_ENTRY_CHANGED notification.
72 struct EntryChangedDetails {
73 // The changed navigation entry after it has been updated.
74 const NavigationEntry* changed_entry;
76 // Indicates the current index in the back/forward list of the entry.
77 int index;
80 // Details sent for NOTIFY_NAV_LIST_PRUNED.
81 struct PrunedDetails {
82 // If true, count items were removed from the front of the list, otherwise
83 // count items were removed from the back of the list.
84 bool from_front;
86 // Number of items removed.
87 int count;
90 } // namespace content
92 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_