| OLD | NEW |
| 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 class SessionStorageBuilder; |
| 28 | 28 |
| 29 // Implementation of NavigationManager. | 29 // Implementation of NavigationManager. |
| 30 // Generally mirrors upstream's NavigationController. | 30 // Generally mirrors upstream's NavigationController. |
| 31 class NavigationManagerImpl : public NavigationManager { | 31 class NavigationManagerImpl : public NavigationManager { |
| 32 public: | 32 public: |
| 33 NavigationManagerImpl(); | 33 NavigationManagerImpl(); |
| 34 ~NavigationManagerImpl() override; | 34 ~NavigationManagerImpl() override; |
| 35 | 35 |
| 36 // Setters for NavigationManagerDelegate and BrowserState. | 36 // Setters for NavigationManagerDelegate and BrowserState. |
| 37 void SetDelegate(NavigationManagerDelegate* delegate); | 37 void SetDelegate(NavigationManagerDelegate* delegate); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void CopyState(NavigationManagerImpl* navigation_manager); | 135 void CopyState(NavigationManagerImpl* navigation_manager); |
| 136 | 136 |
| 137 // 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 |
| 138 // item if it exists) by the specified |offset|, skipping redirect navigation | 138 // item if it exists) by the specified |offset|, skipping redirect navigation |
| 139 // items. The index returned is not guaranteed to be valid. | 139 // items. The index returned is not guaranteed to be valid. |
| 140 // 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 |
| 141 // moved from CRWWebController to NavigationManagerImpl. | 141 // moved from CRWWebController to NavigationManagerImpl. |
| 142 int GetIndexForOffset(int offset) const; | 142 int GetIndexForOffset(int offset) const; |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 // The NavigationManagerStorageBuilder functions require access to | 145 // The SessionStorageBuilder functions require access to private variables of |
| 146 // private variables of NavigationManagerImpl. | 146 // NavigationManagerImpl. |
| 147 friend NavigationManagerStorageBuilder; | 147 friend SessionStorageBuilder; |
| 148 | 148 |
| 149 // Returns true if the PageTransition for the underlying navigation item at | 149 // Returns true if the PageTransition for the underlying navigation item at |
| 150 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. | 150 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. |
| 151 bool IsRedirectItemAtIndex(int index) const; | 151 bool IsRedirectItemAtIndex(int index) const; |
| 152 | 152 |
| 153 // The primary delegate for this manager. | 153 // The primary delegate for this manager. |
| 154 NavigationManagerDelegate* delegate_; | 154 NavigationManagerDelegate* delegate_; |
| 155 | 155 |
| 156 // The BrowserState that is associated with this instance. | 156 // The BrowserState that is associated with this instance. |
| 157 BrowserState* browser_state_; | 157 BrowserState* browser_state_; |
| 158 | 158 |
| 159 // CRWSessionController that backs this instance. | 159 // CRWSessionController that backs this instance. |
| 160 // TODO(stuartmorgan): Fold CRWSessionController into this class. | 160 // TODO(stuartmorgan): Fold CRWSessionController into this class. |
| 161 base::scoped_nsobject<CRWSessionController> session_controller_; | 161 base::scoped_nsobject<CRWSessionController> session_controller_; |
| 162 | 162 |
| 163 // Weak pointer to the facade delegate. | 163 // Weak pointer to the facade delegate. |
| 164 NavigationManagerFacadeDelegate* facade_delegate_; | 164 NavigationManagerFacadeDelegate* facade_delegate_; |
| 165 | 165 |
| 166 // List of transient url rewriters added by |AddTransientURLRewriter()|. | 166 // List of transient url rewriters added by |AddTransientURLRewriter()|. |
| 167 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | 167 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> |
| 168 transient_url_rewriters_; | 168 transient_url_rewriters_; |
| 169 | 169 |
| 170 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl); | 170 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 } // namespace web | 173 } // namespace web |
| 174 | 174 |
| 175 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ | 175 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ |
| OLD | NEW |