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 |
40 // True if the committed entry has replaced the exisiting one. | 47 // True if the committed entry has replaced the exisiting one. |
41 // A non-user initiated redirect causes such replacement. | 48 // A non-user initiated redirect causes such replacement. |
| 49 // This is somewhat similiar to is_auto, but not exactly the same. |
42 bool did_replace_entry; | 50 bool did_replace_entry; |
43 | 51 |
44 // True if the navigation was in-page. This means that the active entry's | 52 // True if the navigation was in-page. This means that the active entry's |
45 // URL and the |previous_url| are the same except for reference fragments. | 53 // URL and the |previous_url| are the same except for reference fragments. |
46 bool is_in_page; | 54 bool is_in_page; |
47 | 55 |
48 // True when the main frame was navigated. False means the navigation was a | 56 // True when the main frame was navigated. False means the navigation was a |
49 // sub-frame. | 57 // sub-frame. |
50 bool is_main_frame; | 58 bool is_main_frame; |
51 | 59 |
52 // When the committed load is a web page from the renderer, this string | 60 // When the committed load is a web page from the renderer, this string |
53 // specifies the security state if the page is secure. | 61 // specifies the security state if the page is secure. |
54 // See ViewHostMsg_FrameNavigate_Params.security_info, where it comes from. | 62 // See ViewHostMsg_FrameNavigate_Params.security_info, where it comes from. |
55 // Use SSLManager::DeserializeSecurityInfo to decode it. | 63 // Use SSLManager::DeserializeSecurityInfo to decode it. |
56 std::string serialized_security_info; | 64 std::string serialized_security_info; |
57 | 65 |
58 // Returns whether the main frame navigated to a different page (e.g., not | 66 // Returns whether the user probably felt like they navigated somewhere new. |
59 // scrolling to a fragment inside the current page). We often need this logic | 67 // We often need this logic for showing or hiding something, and this |
60 // for showing or hiding something. | 68 // returns true only for main frame loads that the user initiated, that go |
61 bool is_navigation_to_different_page() const { | 69 // to a new page. |
62 return is_main_frame && !is_in_page; | 70 bool is_user_initiated_main_frame_load() const { |
| 71 return !is_auto && !is_in_page && is_main_frame; |
63 } | 72 } |
64 | 73 |
65 // The HTTP status code for this entry.. | 74 // The HTTP status code for this entry.. |
66 int http_status_code; | 75 int http_status_code; |
67 }; | 76 }; |
68 | 77 |
69 // Provides the details for a NOTIFY_NAV_ENTRY_CHANGED notification. | 78 // Provides the details for a NOTIFY_NAV_ENTRY_CHANGED notification. |
70 struct EntryChangedDetails { | 79 struct EntryChangedDetails { |
71 // The changed navigation entry after it has been updated. | 80 // The changed navigation entry after it has been updated. |
72 const NavigationEntry* changed_entry; | 81 const NavigationEntry* changed_entry; |
73 | 82 |
74 // Indicates the current index in the back/forward list of the entry. | 83 // Indicates the current index in the back/forward list of the entry. |
75 int index; | 84 int index; |
76 }; | 85 }; |
77 | 86 |
78 // Details sent for NOTIFY_NAV_LIST_PRUNED. | 87 // Details sent for NOTIFY_NAV_LIST_PRUNED. |
79 struct PrunedDetails { | 88 struct PrunedDetails { |
80 // If true, count items were removed from the front of the list, otherwise | 89 // If true, count items were removed from the front of the list, otherwise |
81 // count items were removed from the back of the list. | 90 // count items were removed from the back of the list. |
82 bool from_front; | 91 bool from_front; |
83 | 92 |
84 // Number of items removed. | 93 // Number of items removed. |
85 int count; | 94 int count; |
86 }; | 95 }; |
87 | 96 |
88 } // namespace content | 97 } // namespace content |
89 | 98 |
90 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ | 99 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_DETAILS_H_ |
OLD | NEW |