OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include "content/common/navigation_types.h" | 10 #include "content/common/navigation_types.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // cause a "commit" and won't generate this notification. | 30 // cause a "commit" and won't generate this notification. |
31 NavigationType::Type type; | 31 NavigationType::Type type; |
32 | 32 |
33 // The index of the previously committed navigation entry. This will be -1 | 33 // The index of the previously committed navigation entry. This will be -1 |
34 // if there are no previous entries. | 34 // if there are no previous entries. |
35 int previous_entry_index; | 35 int previous_entry_index; |
36 | 36 |
37 // The previous URL that the user was on. This may be empty if none. | 37 // The previous URL that the user was on. This may be empty if none. |
38 GURL previous_url; | 38 GURL previous_url; |
39 | 39 |
40 // True when this load was non-user initated. This corresponds to a | |
41 // a NavigationGestureAuto call from WebKit (see webview_delegate.h). | |
42 // We also count reloads and meta-refreshes as "auto" to account for the | |
43 // fact that WebKit doesn't always set the user gesture properly in these | |
44 // cases (see bug 1051891). | |
45 bool is_auto; | |
46 | |
47 // True if the committed entry has replaced the exisiting one. | 40 // True if the committed entry has replaced the exisiting one. |
48 // A non-user initiated redirect causes such replacement. | 41 // A non-user initiated redirect causes such replacement. |
49 // This is somewhat similiar to is_auto, but not exactly the same. | |
50 bool did_replace_entry; | 42 bool did_replace_entry; |
51 | 43 |
52 // True if the navigation was in-page. This means that the active entry's | 44 // True if the navigation was in-page. This means that the active entry's |
53 // URL and the |previous_url| are the same except for reference fragments. | 45 // URL and the |previous_url| are the same except for reference fragments. |
54 bool is_in_page; | 46 bool is_in_page; |
55 | 47 |
56 // True when the main frame was navigated. False means the navigation was a | 48 // True when the main frame was navigated. False means the navigation was a |
57 // sub-frame. | 49 // sub-frame. |
58 bool is_main_frame; | 50 bool is_main_frame; |
59 | 51 |
60 // When the committed load is a web page from the renderer, this string | 52 // When the committed load is a web page from the renderer, this string |
61 // specifies the security state if the page is secure. | 53 // specifies the security state if the page is secure. |
62 // See ViewHostMsg_FrameNavigate_Params.security_info, where it comes from. | 54 // See ViewHostMsg_FrameNavigate_Params.security_info, where it comes from. |
63 // Use SSLManager::DeserializeSecurityInfo to decode it. | 55 // Use SSLManager::DeserializeSecurityInfo to decode it. |
64 std::string serialized_security_info; | 56 std::string serialized_security_info; |
65 | 57 |
66 // Returns whether the user probably felt like they navigated somewhere new. | 58 // Returns whether the main frame navigated to a different page (e.g., not |
67 // We often need this logic for showing or hiding something, and this | 59 // scrolling to a fragment inside the current page). We often need this logic |
68 // returns true only for main frame loads that the user initiated, that go | 60 // for showing or hiding something. |
69 // to a new page. | 61 bool is_navigation_to_different_page() const { |
70 bool is_user_initiated_main_frame_load() const { | 62 return is_main_frame && !is_in_page; |
71 return !is_auto && !is_in_page && is_main_frame; | |
72 } | 63 } |
73 | 64 |
74 // The HTTP status code for this entry.. | 65 // The HTTP status code for this entry.. |
75 int http_status_code; | 66 int http_status_code; |
76 }; | 67 }; |
77 | 68 |
78 // Provides the details for a NOTIFY_NAV_ENTRY_CHANGED notification. | 69 // Provides the details for a NOTIFY_NAV_ENTRY_CHANGED notification. |
79 struct EntryChangedDetails { | 70 struct EntryChangedDetails { |
80 // The changed navigation entry after it has been updated. | 71 // The changed navigation entry after it has been updated. |
81 const NavigationEntry* changed_entry; | 72 const NavigationEntry* changed_entry; |
82 | 73 |
83 // Indicates the current index in the back/forward list of the entry. | 74 // Indicates the current index in the back/forward list of the entry. |
84 int index; | 75 int index; |
85 }; | 76 }; |
86 | 77 |
87 // Details sent for NOTIFY_NAV_LIST_PRUNED. | 78 // Details sent for NOTIFY_NAV_LIST_PRUNED. |
88 struct PrunedDetails { | 79 struct PrunedDetails { |
89 // If true, count items were removed from the front of the list, otherwise | 80 // If true, count items were removed from the front of the list, otherwise |
90 // count items were removed from the back of the list. | 81 // count items were removed from the back of the list. |
91 bool from_front; | 82 bool from_front; |
92 | 83 |
93 // Number of items removed. | 84 // Number of items removed. |
94 int count; | 85 int count; |
95 }; | 86 }; |
96 | 87 |
97 } // namespace content | 88 } // namespace content |
98 | 89 |
99 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ | 90 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ |
OLD | NEW |