Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ios/web/navigation/navigation_manager_impl.h

Issue 1360993002: Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compilation fix after rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ 5 #ifndef IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_
6 #define IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ 6 #define IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #import "base/mac/scoped_nsobject.h" 13 #import "base/mac/scoped_nsobject.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #import "ios/web/public/navigation_manager.h" 15 #import "ios/web/public/navigation_manager.h"
16 #include "ui/base/page_transition_types.h" 16 #include "ui/base/page_transition_types.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 @class CRWSessionController; 19 @class CRWSessionController;
20 20
21 namespace web { 21 namespace web {
22 class BrowserState; 22 class BrowserState;
23 class NavigationItem; 23 class NavigationItem;
24 struct Referrer; 24 struct Referrer;
25 class NavigationManagerDelegate; 25 class NavigationManagerDelegate;
26 class NavigationManagerFacadeDelegate; 26 class NavigationManagerFacadeDelegate;
27 class NavigationManagerStorageBuilder;
27 28
28 // Implementation of NavigationManager. 29 // Implementation of NavigationManager.
29 // Generally mirrors upstream's NavigationController. 30 // Generally mirrors upstream's NavigationController.
30 class NavigationManagerImpl : public NavigationManager { 31 class NavigationManagerImpl : public NavigationManager {
31 public: 32 public:
32 NavigationManagerImpl(NavigationManagerDelegate* delegate, 33 NavigationManagerImpl();
33 BrowserState* browser_state);
34 ~NavigationManagerImpl() override; 34 ~NavigationManagerImpl() override;
35 35
36 // Setters for NavigationManagerDelegate and BrowserState.
37 void SetDelegate(NavigationManagerDelegate* delegate);
38 void SetBrowserState(BrowserState* browser_state);
39
36 // Sets the CRWSessionController that backs this object. 40 // Sets the CRWSessionController that backs this object.
37 // Keeps a strong reference to |session_controller|. 41 // Keeps a strong reference to |session_controller|.
38 // This method should only be called when deserializing |session_controller| 42 // This method should only be called when deserializing |session_controller|
39 // and joining it with its NavigationManager. Other cases should call 43 // and joining it with its NavigationManager. Other cases should call
40 // InitializeSession() or ReplaceSessionHistory(). 44 // InitializeSession() or ReplaceSessionHistory().
41 // TODO(stuartmorgan): Also move deserialization of CRWSessionControllers 45 // TODO(stuartmorgan): Also move deserialization of CRWSessionControllers
42 // under the control of this class, and move the bulk of CRWSessionController 46 // under the control of this class, and move the bulk of CRWSessionController
43 // logic into it. 47 // logic into it.
44 void SetSessionController(CRWSessionController* session_controller); 48 void SetSessionController(CRWSessionController* session_controller);
45 49
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void CopyState(NavigationManagerImpl* navigation_manager); 135 void CopyState(NavigationManagerImpl* navigation_manager);
132 136
133 // Returns the navigation index that differs from the current item (or pending 137 // Returns the navigation index that differs from the current item (or pending
134 // item if it exists) by the specified |offset|, skipping redirect navigation 138 // item if it exists) by the specified |offset|, skipping redirect navigation
135 // items. The index returned is not guaranteed to be valid. 139 // items. The index returned is not guaranteed to be valid.
136 // TODO(crbug.com/661316): Make this method private once navigation code is 140 // TODO(crbug.com/661316): Make this method private once navigation code is
137 // moved from CRWWebController to NavigationManagerImpl. 141 // moved from CRWWebController to NavigationManagerImpl.
138 int GetIndexForOffset(int offset) const; 142 int GetIndexForOffset(int offset) const;
139 143
140 private: 144 private:
145 // The NavigationManagerStorageBuilder functions require access to
146 // private variables of NavigationManagerImpl.
147 friend NavigationManagerStorageBuilder;
148
141 // Returns true if the PageTransition for the underlying navigation item at 149 // Returns true if the PageTransition for the underlying navigation item at
142 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. 150 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK.
143 bool IsRedirectItemAtIndex(int index) const; 151 bool IsRedirectItemAtIndex(int index) const;
144 152
145 // The primary delegate for this manager. 153 // The primary delegate for this manager.
146 NavigationManagerDelegate* delegate_; 154 NavigationManagerDelegate* delegate_;
147 155
148 // The BrowserState that is associated with this instance. 156 // The BrowserState that is associated with this instance.
149 BrowserState* browser_state_; 157 BrowserState* browser_state_;
150 158
151 // CRWSessionController that backs this instance. 159 // CRWSessionController that backs this instance.
152 // TODO(stuartmorgan): Fold CRWSessionController into this class. 160 // TODO(stuartmorgan): Fold CRWSessionController into this class.
153 base::scoped_nsobject<CRWSessionController> session_controller_; 161 base::scoped_nsobject<CRWSessionController> session_controller_;
154 162
155 // Weak pointer to the facade delegate. 163 // Weak pointer to the facade delegate.
156 NavigationManagerFacadeDelegate* facade_delegate_; 164 NavigationManagerFacadeDelegate* facade_delegate_;
157 165
158 // List of transient url rewriters added by |AddTransientURLRewriter()|. 166 // List of transient url rewriters added by |AddTransientURLRewriter()|.
159 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> 167 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>>
160 transient_url_rewriters_; 168 transient_url_rewriters_;
161 169
162 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl); 170 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl);
163 }; 171 };
164 172
165 } // namespace web 173 } // namespace web
166 174
167 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ 175 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_controller.mm ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698