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

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

Issue 2698773002: [iOS] Refactoring web CRWSessionController user agent code. (Closed)
Patch Set: Addressed feedback Created 3 years, 10 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>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
Eugene But (OOO till 7-30) 2017/02/16 02:20:48 Please document the difference between UserInitiat
liaoyuke 2017/02/16 22:04:29 Done.
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
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 void OverrideDesktopUserAgentForNextPendingItem() override;
122 134
123 // Returns the current list of transient url rewriters, passing ownership to 135 // Returns the current list of transient url rewriters, passing ownership to
124 // the caller. 136 // the caller.
125 // TODO(crbug.com/546197): remove once NavigationItem creation occurs in this 137 // TODO(crbug.com/546197): remove once NavigationItem creation occurs in this
126 // class. 138 // class.
127 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> 139 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>>
128 GetTransientURLRewriters(); 140 GetTransientURLRewriters();
129 141
130 // Called to reset the transient url rewriter list. 142 // Called to reset the transient url rewriter list.
131 void RemoveTransientURLRewriters(); 143 void RemoveTransientURLRewriters();
(...skipping 11 matching lines...) Expand all
143 155
144 private: 156 private:
145 // The SessionStorageBuilder functions require access to private variables of 157 // The SessionStorageBuilder functions require access to private variables of
146 // NavigationManagerImpl. 158 // NavigationManagerImpl.
147 friend SessionStorageBuilder; 159 friend SessionStorageBuilder;
148 160
149 // Returns true if the PageTransition for the underlying navigation item at 161 // Returns true if the PageTransition for the underlying navigation item at
150 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. 162 // |index| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK.
151 bool IsRedirectItemAtIndex(int index) const; 163 bool IsRedirectItemAtIndex(int index) const;
152 164
165 // Add a new item with the given url, referrer, and navigation type, making it
166 // the current item. If pending item is the same as the current item, this
167 // does nothing. |referrer| may be nil if there isn't one. The item starts
168 // out as pending, and will be lost unless |-commitPendingItem| is called.
169 void AddPendingItem(const GURL& url,
170 const web::Referrer& referrer,
171 ui::PageTransition type,
172 bool renderer_initiated);
173
174 // If true, override navigation item's useDesktopUserAgent flag and always
175 // create the pending entry using the desktop user agent.
176 // TODO(crbug.com/692303): Remove this when overriding the user agent doesn't
177 // create a new NavigationItem.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698