| 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 "ui/base/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_nav_entry_id, |
| 24 int pending_history_list_offset, | 25 int pending_history_list_offset, |
| 25 bool history_list_was_cleared, | 26 bool history_list_was_cleared, |
| 26 ui::PageTransition transition_type) { | 27 ui::PageTransition transition_type) { |
| 27 return new NavigationState(transition_type, | 28 return new NavigationState(transition_type, |
| 28 false, | 29 false, |
| 29 pending_page_id, | 30 pending_page_id, |
| 31 pending_nav_entry_id, |
| 30 pending_history_list_offset, | 32 pending_history_list_offset, |
| 31 history_list_was_cleared); | 33 history_list_was_cleared); |
| 32 } | 34 } |
| 33 | 35 |
| 34 static NavigationState* CreateContentInitiated() { | 36 static NavigationState* CreateContentInitiated() { |
| 35 return new NavigationState( | 37 return new NavigationState( |
| 36 ui::PAGE_TRANSITION_LINK, true, -1, -1, false); | 38 ui::PAGE_TRANSITION_LINK, true, -1, 0, -1, false); |
| 37 } | 39 } |
| 38 | 40 |
| 39 // Contains the page_id for this navigation or -1 if there is none yet. | 41 // Contains the page_id for this navigation or -1 if there is none yet. |
| 40 int32 pending_page_id() const { return pending_page_id_; } | 42 int32 pending_page_id() const { return pending_page_id_; } |
| 41 | 43 |
| 44 // Contains the nav_entry_id for this navigation if it is browser-initiated, |
| 45 // or 0 if there is none because it was renderer-initiated. |
| 46 int32 pending_nav_entry_id() const { |
| 47 return pending_nav_entry_id_; |
| 48 } |
| 49 |
| 42 // If pending_page_id() is not -1, then this contains the corresponding | 50 // If pending_page_id() is not -1, then this contains the corresponding |
| 43 // offset of the page in the back/forward history list. | 51 // offset of the page in the back/forward history list. |
| 44 int pending_history_list_offset() const { | 52 int pending_history_list_offset() const { |
| 45 return pending_history_list_offset_; | 53 return pending_history_list_offset_; |
| 46 } | 54 } |
| 47 | 55 |
| 48 // If pending_page_id() is not -1, then this returns true if the session | 56 // If pending_page_id() is not -1, then this returns true if the session |
| 49 // history was cleared during this navigation. | 57 // history was cleared during this navigation. |
| 50 bool history_list_was_cleared() const { | 58 bool history_list_was_cleared() const { |
| 51 return history_list_was_cleared_; | 59 return history_list_was_cleared_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 120 |
| 113 void set_extra_headers(const std::string& extra_headers) { | 121 void set_extra_headers(const std::string& extra_headers) { |
| 114 extra_headers_ = extra_headers; | 122 extra_headers_ = extra_headers; |
| 115 } | 123 } |
| 116 const std::string& extra_headers() { return extra_headers_; } | 124 const std::string& extra_headers() { return extra_headers_; } |
| 117 | 125 |
| 118 private: | 126 private: |
| 119 NavigationState(ui::PageTransition transition_type, | 127 NavigationState(ui::PageTransition transition_type, |
| 120 bool is_content_initiated, | 128 bool is_content_initiated, |
| 121 int32 pending_page_id, | 129 int32 pending_page_id, |
| 130 int pending_nav_entry_id, |
| 122 int pending_history_list_offset, | 131 int pending_history_list_offset, |
| 123 bool history_list_was_cleared); | 132 bool history_list_was_cleared); |
| 124 | 133 |
| 125 ui::PageTransition transition_type_; | 134 ui::PageTransition transition_type_; |
| 126 bool request_committed_; | 135 bool request_committed_; |
| 127 bool is_content_initiated_; | 136 bool is_content_initiated_; |
| 128 int32 pending_page_id_; | 137 int32 pending_page_id_; |
| 138 int pending_nav_entry_id_; |
| 129 int pending_history_list_offset_; | 139 int pending_history_list_offset_; |
| 130 bool history_list_was_cleared_; | 140 bool history_list_was_cleared_; |
| 131 bool should_replace_current_entry_; | 141 bool should_replace_current_entry_; |
| 132 | 142 |
| 133 bool was_within_same_page_; | 143 bool was_within_same_page_; |
| 134 int transferred_request_child_id_; | 144 int transferred_request_child_id_; |
| 135 int transferred_request_request_id_; | 145 int transferred_request_request_id_; |
| 136 bool allow_download_; | 146 bool allow_download_; |
| 137 std::string extra_headers_; | 147 std::string extra_headers_; |
| 138 | 148 |
| 139 DISALLOW_COPY_AND_ASSIGN(NavigationState); | 149 DISALLOW_COPY_AND_ASSIGN(NavigationState); |
| 140 }; | 150 }; |
| 141 | 151 |
| 142 } // namespace content | 152 } // namespace content |
| 143 | 153 |
| 144 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 154 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
| OLD | NEW |