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

Side by Side Diff: ios/web/public/navigation_manager.h

Issue 2779383002: implement user agent override option. (Closed)
Patch Set: Rebase Created 3 years, 8 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_PUBLIC_NAVIGATION_MANAGER_H_ 5 #ifndef IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_
6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ 6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 12 matching lines...) Expand all
23 class NavigationItem; 23 class NavigationItem;
24 class WebState; 24 class WebState;
25 25
26 // A NavigationManager maintains the back-forward list for a WebState and 26 // A NavigationManager maintains the back-forward list for a WebState and
27 // manages all navigation within that list. 27 // manages all navigation within that list.
28 // 28 //
29 // Each NavigationManager belongs to one WebState; each WebState has 29 // Each NavigationManager belongs to one WebState; each WebState has
30 // exactly one NavigationManager. 30 // exactly one NavigationManager.
31 class NavigationManager { 31 class NavigationManager {
32 public: 32 public:
33 // User agent override option used in LoadURLParams.
34 enum class UserAgentOverrideOption : short {
35 // Inherit the user agent type from the last committed non-native item if
36 // there is one, otherwise keep the default type, which is NONE for native
37 // item and MOBILE for non-native item.
38 INHERIT = 0,
39
40 // Use the mobile user agent.
41 MOBILE,
42
43 // Use the desktop user agent.
44 DESKTOP,
45 };
46
33 // Parameters for URL loading. Most parameters are optional, and can be left 47 // Parameters for URL loading. Most parameters are optional, and can be left
34 // at the default values set by the constructor. 48 // at the default values set by the constructor.
35 struct WebLoadParams { 49 struct WebLoadParams {
36 public: 50 public:
37 // The URL to load. Must be set. 51 // The URL to load. Must be set.
38 GURL url; 52 GURL url;
39 53
40 // The referrer for the load. May be empty. 54 // The referrer for the load. May be empty.
41 Referrer referrer; 55 Referrer referrer;
42 56
43 // The transition type for the load. Defaults to PAGE_TRANSITION_LINK. 57 // The transition type for the load. Defaults to PAGE_TRANSITION_LINK.
44 ui::PageTransition transition_type; 58 ui::PageTransition transition_type;
45 59
60 // The user agent override option for the load. Defualts to INHERIT.
61 UserAgentOverrideOption user_agent_override_option;
62
46 // True for renderer-initiated navigations. This is 63 // True for renderer-initiated navigations. This is
47 // important for tracking whether to display pending URLs. 64 // important for tracking whether to display pending URLs.
48 bool is_renderer_initiated; 65 bool is_renderer_initiated;
49 66
50 // Any extra HTTP headers to add to the load. 67 // Any extra HTTP headers to add to the load.
51 base::scoped_nsobject<NSDictionary> extra_headers; 68 base::scoped_nsobject<NSDictionary> extra_headers;
52 69
53 // Any post data to send with the load. When setting this, you should 70 // Any post data to send with the load. When setting this, you should
54 // generally set a Content-Type header as well. 71 // generally set a Content-Type header as well.
55 base::scoped_nsobject<NSData> post_data; 72 base::scoped_nsobject<NSData> post_data;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // This ignores any pending or transient entries in |source|. This will be a 189 // This ignores any pending or transient entries in |source|. This will be a
173 // no-op if called while CanPruneAllButLastCommittedItem() is false. 190 // no-op if called while CanPruneAllButLastCommittedItem() is false.
174 virtual void CopyStateFromAndPrune(const NavigationManager* source) = 0; 191 virtual void CopyStateFromAndPrune(const NavigationManager* source) = 0;
175 192
176 // Whether the NavigationManager can prune all but the last committed item. 193 // Whether the NavigationManager can prune all but the last committed item.
177 // This is true when all the following conditions are met: 194 // This is true when all the following conditions are met:
178 // - There is a last committed NavigationItem. 195 // - There is a last committed NavigationItem.
179 // - There is no pending history navigation. 196 // - There is no pending history navigation.
180 // - There is no transient NavigationItem. 197 // - There is no transient NavigationItem.
181 virtual bool CanPruneAllButLastCommittedItem() const = 0; 198 virtual bool CanPruneAllButLastCommittedItem() const = 0;
182
183 // Forces the pending item to be loaded using desktop user agent. Note that
184 // the pending item may or may not already exist.
185 // TODO(crbug.com/692303): Remove this when overriding the user agent doesn't
186 // create a new NavigationItem.
187 virtual void OverrideDesktopUserAgentForNextPendingItem() = 0;
188 }; 199 };
189 200
190 } // namespace web 201 } // namespace web
191 202
192 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ 203 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_
OLDNEW
« no previous file with comments | « ios/web/navigation/navigation_manager_impl_unittest.mm ('k') | ios/web/public/test/fakes/test_navigation_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698