OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_RENDERER_NAVIGATION_STATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ |
6 #define CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ | 6 #define CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/navigation_params.h" | 11 #include "content/common/navigation_params.h" |
12 #include "content/public/renderer/navigation_state.h" | 12 #include "content/public/renderer/navigation_state.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class CONTENT_EXPORT NavigationStateImpl : public NavigationState { | 16 class CONTENT_EXPORT NavigationStateImpl : public NavigationState { |
17 public: | 17 public: |
18 ~NavigationStateImpl() override; | 18 ~NavigationStateImpl() override; |
19 | 19 |
20 static NavigationStateImpl* CreateBrowserInitiated( | 20 static NavigationStateImpl* CreateBrowserInitiated( |
21 const CommonNavigationParams& common_params, | 21 const CommonNavigationParams& common_params, |
22 const StartNavigationParams& start_params, | 22 const StartNavigationParams& start_params, |
23 const RequestNavigationParams& request_params); | 23 const RequestNavigationParams& request_params); |
24 | 24 |
25 static NavigationStateImpl* CreateContentInitiated(); | 25 static NavigationStateImpl* CreateContentInitiated(); |
26 | 26 |
27 // NavigationState implementation. | 27 // NavigationState implementation. |
28 ui::PageTransition GetTransitionType() override; | 28 ui::PageTransition GetTransitionType() override; |
29 bool WasWithinSamePage() override; | 29 bool WasWithinSameDocument() override; |
30 bool IsContentInitiated() override; | 30 bool IsContentInitiated() override; |
31 | 31 |
32 const CommonNavigationParams& common_params() const { return common_params_; } | 32 const CommonNavigationParams& common_params() const { return common_params_; } |
33 const StartNavigationParams& start_params() const { return start_params_; } | 33 const StartNavigationParams& start_params() const { return start_params_; } |
34 const RequestNavigationParams& request_params() const { | 34 const RequestNavigationParams& request_params() const { |
35 return request_params_; | 35 return request_params_; |
36 } | 36 } |
37 bool request_committed() const { return request_committed_; } | 37 bool request_committed() const { return request_committed_; } |
38 void set_request_committed(bool value) { request_committed_ = value; } | 38 void set_request_committed(bool value) { request_committed_ = value; } |
39 void set_was_within_same_page(bool value) { was_within_same_page_ = value; } | 39 void set_was_within_same_document(bool value) { |
| 40 was_within_same_document_ = value; |
| 41 } |
40 | 42 |
41 void set_transition_type(ui::PageTransition transition) { | 43 void set_transition_type(ui::PageTransition transition) { |
42 common_params_.transition = transition; | 44 common_params_.transition = transition; |
43 } | 45 } |
44 | 46 |
45 private: | 47 private: |
46 NavigationStateImpl(const CommonNavigationParams& common_params, | 48 NavigationStateImpl(const CommonNavigationParams& common_params, |
47 const StartNavigationParams& start_params, | 49 const StartNavigationParams& start_params, |
48 const RequestNavigationParams& request_params, | 50 const RequestNavigationParams& request_params, |
49 bool is_content_initiated); | 51 bool is_content_initiated); |
50 | 52 |
51 bool request_committed_; | 53 bool request_committed_; |
52 bool was_within_same_page_; | 54 bool was_within_same_document_; |
53 | 55 |
54 // True if this navigation was not initiated via WebFrame::LoadRequest. | 56 // True if this navigation was not initiated via WebFrame::LoadRequest. |
55 const bool is_content_initiated_; | 57 const bool is_content_initiated_; |
56 | 58 |
57 CommonNavigationParams common_params_; | 59 CommonNavigationParams common_params_; |
58 const StartNavigationParams start_params_; | 60 const StartNavigationParams start_params_; |
59 | 61 |
60 // Note: if IsContentInitiated() is false, whether this navigation should | 62 // Note: if IsContentInitiated() is false, whether this navigation should |
61 // replace the current entry in the back/forward history list is determined by | 63 // replace the current entry in the back/forward history list is determined by |
62 // the should_replace_current_entry field in |history_params|. Otherwise, use | 64 // the should_replace_current_entry field in |history_params|. Otherwise, use |
63 // replacesCurrentHistoryItem() on the WebDataSource. | 65 // replacesCurrentHistoryItem() on the WebDataSource. |
64 // | 66 // |
65 // TODO(davidben): It would be good to unify these and have only one source | 67 // TODO(davidben): It would be good to unify these and have only one source |
66 // for the two cases. We can plumb this through WebFrame::loadRequest to set | 68 // for the two cases. We can plumb this through WebFrame::loadRequest to set |
67 // lockBackForwardList on the FrameLoadRequest. However, this breaks process | 69 // lockBackForwardList on the FrameLoadRequest. However, this breaks process |
68 // swaps because FrameLoader::loadWithNavigationAction treats loads before a | 70 // swaps because FrameLoader::loadWithNavigationAction treats loads before a |
69 // FrameLoader has committedFirstRealDocumentLoad as a replacement. (Added for | 71 // FrameLoader has committedFirstRealDocumentLoad as a replacement. (Added for |
70 // http://crbug.com/178380). | 72 // http://crbug.com/178380). |
71 const RequestNavigationParams request_params_; | 73 const RequestNavigationParams request_params_; |
72 | 74 |
73 DISALLOW_COPY_AND_ASSIGN(NavigationStateImpl); | 75 DISALLOW_COPY_AND_ASSIGN(NavigationStateImpl); |
74 }; | 76 }; |
75 | 77 |
76 } // namespace content | 78 } // namespace content |
77 | 79 |
78 #endif // CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ | 80 #endif // CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ |
OLD | NEW |