Chromium Code Reviews| 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> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 void OnNavigationItemCommitted(); | 75 void OnNavigationItemCommitted(); |
| 76 | 76 |
| 77 // Temporary accessors and content/ class pass-throughs. | 77 // Temporary accessors and content/ class pass-throughs. |
| 78 // TODO(stuartmorgan): Re-evaluate this list once the refactorings have | 78 // TODO(stuartmorgan): Re-evaluate this list once the refactorings have |
| 79 // settled down. | 79 // settled down. |
| 80 CRWSessionController* GetSessionController(); | 80 CRWSessionController* GetSessionController(); |
| 81 void LoadURL(const GURL& url, | 81 void LoadURL(const GURL& url, |
| 82 const Referrer& referrer, | 82 const Referrer& referrer, |
| 83 ui::PageTransition type); | 83 ui::PageTransition type); |
| 84 | 84 |
| 85 // Add a new item with the given url, referrer, and navigation type, making it | |
| 86 // the current item. If pending item is the same as the current item, this | |
| 87 // does nothing. |referrer| may be nil if there isn't one. The item starts | |
| 88 // out as pending, and will be lost unless |-commitPendingItem| is called. | |
| 89 void AddUserInitiatedPendingItem(const GURL& url, | |
| 90 const web::Referrer& referrer, | |
| 91 ui::PageTransition type); | |
| 92 void AddRendererInitiatedPendingItem(const GURL& url, | |
| 93 const web::Referrer& referrer, | |
| 94 ui::PageTransition type); | |
| 95 | |
| 85 // Convenience accessors to get the underlying NavigationItems from the | 96 // Convenience accessors to get the underlying NavigationItems from the |
| 86 // SessionEntries returned from |session_controller_|'s -lastUserEntry and | 97 // SessionEntries returned from |session_controller_|'s -lastUserEntry and |
| 87 // -previousEntry methods. | 98 // -previousEntry methods. |
| 88 // TODO(crbug.com/546365): Remove these methods. | 99 // TODO(crbug.com/546365): Remove these methods. |
| 89 NavigationItem* GetLastUserItem() const; | 100 NavigationItem* GetLastUserItem() const; |
| 90 NavigationItem* GetPreviousItem() const; | 101 NavigationItem* GetPreviousItem() const; |
| 91 | 102 |
| 92 // Temporary method. Returns a vector of NavigationItems corresponding to | 103 // Temporary method. Returns a vector of NavigationItems corresponding to |
| 93 // the SessionEntries of the uderlying CRWSessionController. | 104 // the SessionEntries of the uderlying CRWSessionController. |
| 94 // TODO(crbug.com/546365): Remove this method. | 105 // TODO(crbug.com/546365): Remove this method. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 112 int GetPendingItemIndex() const override; | 123 int GetPendingItemIndex() const override; |
| 113 int GetLastCommittedItemIndex() const override; | 124 int GetLastCommittedItemIndex() const override; |
| 114 bool RemoveItemAtIndex(int index) override; | 125 bool RemoveItemAtIndex(int index) override; |
| 115 bool CanGoBack() const override; | 126 bool CanGoBack() const override; |
| 116 bool CanGoForward() const override; | 127 bool CanGoForward() const override; |
| 117 bool CanGoToOffset(int offset) const override; | 128 bool CanGoToOffset(int offset) const override; |
| 118 void GoBack() override; | 129 void GoBack() override; |
| 119 void GoForward() override; | 130 void GoForward() override; |
| 120 void GoToIndex(int index) override; | 131 void GoToIndex(int index) override; |
| 121 void Reload(bool check_for_reposts) override; | 132 void Reload(bool check_for_reposts) override; |
| 133 // Removes this method once crbug.com/692303 is fixed. | |
|
kkhorimoto
2017/02/15 23:02:06
This comment isn't really necessary since it's alr
liaoyuke
2017/02/16 01:49:05
Done.
| |
| 134 void OverrideDesktopUserAgentForNextPendingItem() override; | |
| 122 | 135 |
| 123 // Returns the current list of transient url rewriters, passing ownership to | 136 // Returns the current list of transient url rewriters, passing ownership to |
| 124 // the caller. | 137 // the caller. |
| 125 // TODO(crbug.com/546197): remove once NavigationItem creation occurs in this | 138 // TODO(crbug.com/546197): remove once NavigationItem creation occurs in this |
| 126 // class. | 139 // class. |
| 127 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | 140 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> |
| 128 GetTransientURLRewriters(); | 141 GetTransientURLRewriters(); |
| 129 | 142 |
| 130 // Called to reset the transient url rewriter list. | 143 // Called to reset the transient url rewriter list. |
| 131 void RemoveTransientURLRewriters(); | 144 void RemoveTransientURLRewriters(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 143 | 156 |
| 144 private: | 157 private: |
| 145 // The SessionStorageBuilder functions require access to private variables of | 158 // The SessionStorageBuilder functions require access to private variables of |
| 146 // NavigationManagerImpl. | 159 // NavigationManagerImpl. |
| 147 friend SessionStorageBuilder; | 160 friend SessionStorageBuilder; |
| 148 | 161 |
| 149 // Returns true if the PageTransition for the underlying navigation item at | 162 // Returns true if the PageTransition for the underlying navigation item at |
| 150 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. | 163 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. |
| 151 bool IsRedirectItemAtIndex(int index) const; | 164 bool IsRedirectItemAtIndex(int index) const; |
| 152 | 165 |
| 166 // Add a new item with the given url, referrer, and navigation type, making it | |
| 167 // the current item. If pending item is the same as the current item, this | |
| 168 // does nothing. |referrer| may be nil if there isn't one. The item starts | |
| 169 // out as pending, and will be lost unless |-commitPendingItem| is called. | |
| 170 void AddPendingItem(const GURL& url, | |
|
kkhorimoto
2017/02/15 23:02:06
Why not just expose this in the public interface i
liaoyuke
2017/02/16 01:49:05
I feel like having a boolean value as a function p
| |
| 171 const web::Referrer& referrer, | |
| 172 ui::PageTransition type, | |
| 173 bool rendererInitiated); | |
|
kkhorimoto
2017/02/15 23:02:06
s/rendererInitiated/renderer_initiated
liaoyuke
2017/02/16 01:49:05
Done.
| |
| 174 | |
| 175 // If true, override navigation item's useDesktopUserAgent flag and always | |
| 176 // create the pending entry using the desktop user agent. | |
| 177 // Removes this method once crbug.com/692303 is fixed. | |
| 178 bool override_desktop_user_agent_for_next_pending_item_; | |
| 179 | |
| 153 // The primary delegate for this manager. | 180 // The primary delegate for this manager. |
| 154 NavigationManagerDelegate* delegate_; | 181 NavigationManagerDelegate* delegate_; |
| 155 | 182 |
| 156 // The BrowserState that is associated with this instance. | 183 // The BrowserState that is associated with this instance. |
| 157 BrowserState* browser_state_; | 184 BrowserState* browser_state_; |
| 158 | 185 |
| 159 // CRWSessionController that backs this instance. | 186 // CRWSessionController that backs this instance. |
| 160 // TODO(stuartmorgan): Fold CRWSessionController into this class. | 187 // TODO(stuartmorgan): Fold CRWSessionController into this class. |
| 161 base::scoped_nsobject<CRWSessionController> session_controller_; | 188 base::scoped_nsobject<CRWSessionController> session_controller_; |
| 162 | 189 |
| 163 // Weak pointer to the facade delegate. | 190 // Weak pointer to the facade delegate. |
| 164 NavigationManagerFacadeDelegate* facade_delegate_; | 191 NavigationManagerFacadeDelegate* facade_delegate_; |
| 165 | 192 |
| 166 // List of transient url rewriters added by |AddTransientURLRewriter()|. | 193 // List of transient url rewriters added by |AddTransientURLRewriter()|. |
| 167 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | 194 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> |
| 168 transient_url_rewriters_; | 195 transient_url_rewriters_; |
| 169 | 196 |
| 170 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl); | 197 DISALLOW_COPY_AND_ASSIGN(NavigationManagerImpl); |
| 171 }; | 198 }; |
| 172 | 199 |
| 173 } // namespace web | 200 } // namespace web |
| 174 | 201 |
| 175 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ | 202 #endif // IOS_WEB_NAVIGATION_NAVIGATION_MANAGER_IMPL_H_ |
| OLD | NEW |