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

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

Issue 2698773002: [iOS] Refactoring web CRWSessionController user agent code. (Closed)
Patch Set: Fix unit tests and rebase 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
« no previous file with comments | « ios/chrome/browser/tabs/tab_unittest.mm ('k') | ios/web/navigation/crw_session_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_CRW_SESSION_CONTROLLER_H_ 5 #ifndef IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_
6 #define IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ 6 #define IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ios/web/public/navigation_item_list.h" 11 #include "ios/web/public/navigation_item_list.h"
12 #include "ui/base/page_transition_types.h" 12 #include "ui/base/page_transition_types.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 @class CRWSessionEntry; 15 @class CRWSessionEntry;
16 @class CRWSessionCertificatePolicyManager; 16 @class CRWSessionCertificatePolicyManager;
17 17
18 namespace web { 18 namespace web {
19 class BrowserState; 19 class BrowserState;
20 class NavigationItemImpl; 20 class NavigationItemImpl;
21 class NavigationManagerImpl; 21 class NavigationManagerImpl;
22 enum class NavigationInitiationType;
22 struct Referrer; 23 struct Referrer;
23 } 24 }
24 25
25 // A CRWSessionController is similar to a NavigationController object in desktop 26 // A CRWSessionController is similar to a NavigationController object in desktop
26 // Chrome. It maintains information needed to save/restore a tab with its 27 // Chrome. It maintains information needed to save/restore a tab with its
27 // complete session history. There is one of these for each tab. 28 // complete session history. There is one of these for each tab.
28 // DEPRECATED, do not use this class and do not add any methods to it. 29 // DEPRECATED, do not use this class and do not add any methods to it.
29 // Use web::NavigationManager instead. 30 // Use web::NavigationManager instead.
30 // TODO(crbug.com/454984): Remove this class. 31 // TODO(crbug.com/454984): Remove this class.
31 @interface CRWSessionController : NSObject<NSCopying> 32 @interface CRWSessionController : NSObject<NSCopying>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // CRWSessionController doesn't have public constructors. New 90 // CRWSessionController doesn't have public constructors. New
90 // CRWSessionControllers are created by deserialization, or via a 91 // CRWSessionControllers are created by deserialization, or via a
91 // NavigationManager. 92 // NavigationManager.
92 93
93 // Sets the corresponding NavigationManager. 94 // Sets the corresponding NavigationManager.
94 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager; 95 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager;
95 // Sets the corresponding BrowserState. 96 // Sets the corresponding BrowserState.
96 - (void)setBrowserState:(web::BrowserState*)browserState; 97 - (void)setBrowserState:(web::BrowserState*)browserState;
97 98
98 // Add a new item with the given url, referrer, and navigation type, making it 99 // Add a new item with the given url, referrer, and navigation type, making it
99 // the current item. If |url| is the same as the current item's url, this 100 // the current item. If pending item is the same as current item, this does
100 // does nothing. |referrer| may be nil if there isn't one. The item starts 101 // nothing. |referrer| may be nil if there isn't one. The item starts out as
101 // out as pending, and will be lost unless |-commitPendingItem| is called. 102 // pending, and will be lost unless |-commitPendingItem| is called.
102 - (void)addPendingItem:(const GURL&)url 103 - (void)addPendingItem:(const GURL&)url
103 referrer:(const web::Referrer&)referrer 104 referrer:(const web::Referrer&)referrer
104 transition:(ui::PageTransition)type 105 transition:(ui::PageTransition)type
105 rendererInitiated:(BOOL)rendererInitiated; 106 initiationType:(web::NavigationInitiationType)initiationType;
106 107
107 // Updates the URL of the yet to be committed pending item. Useful for page 108 // Updates the URL of the yet to be committed pending item. Useful for page
108 // redirects. Does nothing if there is no pending item. 109 // redirects. Does nothing if there is no pending item.
109 - (void)updatePendingItem:(const GURL&)url; 110 - (void)updatePendingItem:(const GURL&)url;
110 111
111 // Commits the current pending item. No changes are made to the item during 112 // Commits the current pending item. No changes are made to the item during
112 // this process, it is just moved from pending to committed. 113 // this process, it is just moved from pending to committed.
113 // TODO(pinkerton): Desktop Chrome broadcasts a notification here, should we? 114 // TODO(pinkerton): Desktop Chrome broadcasts a notification here, should we?
114 - (void)commitPendingItem; 115 - (void)commitPendingItem;
115 116
(...skipping 29 matching lines...) Expand all
145 // Removes the item at |index| after discarding any noncomitted entries. 146 // Removes the item at |index| after discarding any noncomitted entries.
146 // |index| must not be the index of the last committed item, or a noncomitted 147 // |index| must not be the index of the last committed item, or a noncomitted
147 // item. 148 // item.
148 - (void)removeItemAtIndex:(NSInteger)index; 149 - (void)removeItemAtIndex:(NSInteger)index;
149 150
150 // Determines whether a navigation between |firstEntry| and |secondEntry| is a 151 // Determines whether a navigation between |firstEntry| and |secondEntry| is a
151 // same-document navigation. Entries can be passed in any order. 152 // same-document navigation. Entries can be passed in any order.
152 - (BOOL)isSameDocumentNavigationBetweenItem:(web::NavigationItem*)firstItem 153 - (BOOL)isSameDocumentNavigationBetweenItem:(web::NavigationItem*)firstItem
153 andItem:(web::NavigationItem*)secondItem; 154 andItem:(web::NavigationItem*)secondItem;
154 155
155 // Set |useDesktopUserAgentForNextPendingItem_| to YES if there is no pending
156 // entry, otherwise set |useDesktopUserAgent| in the pending entry.
157 - (void)useDesktopUserAgentForNextPendingItem;
158
159 // Returns the index of |item| in |items|. 156 // Returns the index of |item| in |items|.
160 - (NSInteger)indexOfItem:(const web::NavigationItem*)item; 157 - (NSInteger)indexOfItem:(const web::NavigationItem*)item;
161 158
162 @end 159 @end
163 160
164 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ 161 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_unittest.mm ('k') | ios/web/navigation/crw_session_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698