OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
6 #define CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 6 #define CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/common/page_transition_types.h" | 11 #include "ui/base/page_transition_types.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // NavigationState is the portion of DocumentState that is affected by | 15 // NavigationState is the portion of DocumentState that is affected by |
16 // in-document navigation. | 16 // in-document navigation. |
17 // TODO(simonjam): Move this to HistoryItem's ExtraData. | 17 // TODO(simonjam): Move this to HistoryItem's ExtraData. |
18 class CONTENT_EXPORT NavigationState { | 18 class CONTENT_EXPORT NavigationState { |
19 public: | 19 public: |
20 virtual ~NavigationState(); | 20 virtual ~NavigationState(); |
21 | 21 |
22 static NavigationState* CreateBrowserInitiated( | 22 static NavigationState* CreateBrowserInitiated( |
23 int32 pending_page_id, | 23 int32 pending_page_id, |
24 int pending_history_list_offset, | 24 int pending_history_list_offset, |
25 bool history_list_was_cleared, | 25 bool history_list_was_cleared, |
26 content::PageTransition transition_type) { | 26 ui::PageTransition transition_type) { |
27 return new NavigationState(transition_type, | 27 return new NavigationState(transition_type, |
28 false, | 28 false, |
29 pending_page_id, | 29 pending_page_id, |
30 pending_history_list_offset, | 30 pending_history_list_offset, |
31 history_list_was_cleared); | 31 history_list_was_cleared); |
32 } | 32 } |
33 | 33 |
34 static NavigationState* CreateContentInitiated() { | 34 static NavigationState* CreateContentInitiated() { |
35 return new NavigationState( | 35 return new NavigationState( |
36 content::PAGE_TRANSITION_LINK, true, -1, -1, false); | 36 ui::PAGE_TRANSITION_LINK, true, -1, -1, false); |
37 } | 37 } |
38 | 38 |
39 // Contains the page_id for this navigation or -1 if there is none yet. | 39 // Contains the page_id for this navigation or -1 if there is none yet. |
40 int32 pending_page_id() const { return pending_page_id_; } | 40 int32 pending_page_id() const { return pending_page_id_; } |
41 | 41 |
42 // If pending_page_id() is not -1, then this contains the corresponding | 42 // If pending_page_id() is not -1, then this contains the corresponding |
43 // offset of the page in the back/forward history list. | 43 // offset of the page in the back/forward history list. |
44 int pending_history_list_offset() const { | 44 int pending_history_list_offset() const { |
45 return pending_history_list_offset_; | 45 return pending_history_list_offset_; |
46 } | 46 } |
(...skipping 16 matching lines...) Expand all Loading... |
63 // http://crbug.com/178380). | 63 // http://crbug.com/178380). |
64 bool should_replace_current_entry() const { | 64 bool should_replace_current_entry() const { |
65 return should_replace_current_entry_; | 65 return should_replace_current_entry_; |
66 } | 66 } |
67 void set_should_replace_current_entry(bool value) { | 67 void set_should_replace_current_entry(bool value) { |
68 should_replace_current_entry_ = value; | 68 should_replace_current_entry_ = value; |
69 } | 69 } |
70 | 70 |
71 // Contains the transition type that the browser specified when it | 71 // Contains the transition type that the browser specified when it |
72 // initiated the load. | 72 // initiated the load. |
73 content::PageTransition transition_type() const { return transition_type_; } | 73 ui::PageTransition transition_type() const { return transition_type_; } |
74 void set_transition_type(content::PageTransition type) { | 74 void set_transition_type(ui::PageTransition type) { |
75 transition_type_ = type; | 75 transition_type_ = type; |
76 } | 76 } |
77 | 77 |
78 // True if we have already processed the "DidCommitLoad" event for this | 78 // True if we have already processed the "DidCommitLoad" event for this |
79 // request. Used by session history. | 79 // request. Used by session history. |
80 bool request_committed() const { return request_committed_; } | 80 bool request_committed() const { return request_committed_; } |
81 void set_request_committed(bool value) { request_committed_ = value; } | 81 void set_request_committed(bool value) { request_committed_ = value; } |
82 | 82 |
83 // True if this navigation was not initiated via WebFrame::LoadRequest. | 83 // True if this navigation was not initiated via WebFrame::LoadRequest. |
84 bool is_content_initiated() const { return is_content_initiated_; } | 84 bool is_content_initiated() const { return is_content_initiated_; } |
(...skipping 24 matching lines...) Expand all Loading... |
109 bool allow_download() const { | 109 bool allow_download() const { |
110 return allow_download_; | 110 return allow_download_; |
111 } | 111 } |
112 | 112 |
113 void set_extra_headers(const std::string& extra_headers) { | 113 void set_extra_headers(const std::string& extra_headers) { |
114 extra_headers_ = extra_headers; | 114 extra_headers_ = extra_headers; |
115 } | 115 } |
116 const std::string& extra_headers() { return extra_headers_; } | 116 const std::string& extra_headers() { return extra_headers_; } |
117 | 117 |
118 private: | 118 private: |
119 NavigationState(content::PageTransition transition_type, | 119 NavigationState(ui::PageTransition transition_type, |
120 bool is_content_initiated, | 120 bool is_content_initiated, |
121 int32 pending_page_id, | 121 int32 pending_page_id, |
122 int pending_history_list_offset, | 122 int pending_history_list_offset, |
123 bool history_list_was_cleared); | 123 bool history_list_was_cleared); |
124 | 124 |
125 content::PageTransition transition_type_; | 125 ui::PageTransition transition_type_; |
126 bool request_committed_; | 126 bool request_committed_; |
127 bool is_content_initiated_; | 127 bool is_content_initiated_; |
128 int32 pending_page_id_; | 128 int32 pending_page_id_; |
129 int pending_history_list_offset_; | 129 int pending_history_list_offset_; |
130 bool history_list_was_cleared_; | 130 bool history_list_was_cleared_; |
131 bool should_replace_current_entry_; | 131 bool should_replace_current_entry_; |
132 | 132 |
133 bool was_within_same_page_; | 133 bool was_within_same_page_; |
134 int transferred_request_child_id_; | 134 int transferred_request_child_id_; |
135 int transferred_request_request_id_; | 135 int transferred_request_request_id_; |
136 bool allow_download_; | 136 bool allow_download_; |
137 std::string extra_headers_; | 137 std::string extra_headers_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(NavigationState); | 139 DISALLOW_COPY_AND_ASSIGN(NavigationState); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace content | 142 } // namespace content |
143 | 143 |
144 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 144 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
OLD | NEW |