| OLD | NEW |
| 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_CHROME_BROWSER_TABS_TAB_H_ | 5 #ifndef IOS_CHROME_BROWSER_TABS_TAB_H_ |
| 6 #define IOS_CHROME_BROWSER_TABS_TAB_H_ | 6 #define IOS_CHROME_BROWSER_TABS_TAB_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 namespace sessions { | 53 namespace sessions { |
| 54 class SerializedNavigationEntry; | 54 class SerializedNavigationEntry; |
| 55 struct SessionTab; | 55 struct SessionTab; |
| 56 } | 56 } |
| 57 | 57 |
| 58 namespace web { | 58 namespace web { |
| 59 class NavigationItem; | 59 class NavigationItem; |
| 60 class NavigationManager; | 60 class NavigationManager; |
| 61 class NavigationManagerImpl; | 61 class NavigationManagerImpl; |
| 62 struct Referrer; | |
| 63 class WebState; | 62 class WebState; |
| 64 } | 63 } |
| 65 | 64 |
| 66 // Notification sent by a Tab when it starts to load a new URL. This | 65 // Notification sent by a Tab when it starts to load a new URL. This |
| 67 // notification must only be used for crash reporting as it is also sent for | 66 // notification must only be used for crash reporting as it is also sent for |
| 68 // pre-rendered tabs. | 67 // pre-rendered tabs. |
| 69 extern NSString* const kTabUrlStartedLoadingNotificationForCrashReporting; | 68 extern NSString* const kTabUrlStartedLoadingNotificationForCrashReporting; |
| 70 | 69 |
| 71 // Notification sent by a Tab when it is likely about to start loading a new | 70 // Notification sent by a Tab when it is likely about to start loading a new |
| 72 // URL. This notification must only be used for crash reporting as it is also | 71 // URL. This notification must only be used for crash reporting as it is also |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 @property(nonatomic, readonly) NSString* title; | 111 @property(nonatomic, readonly) NSString* title; |
| 113 | 112 |
| 114 // Original page title or nil if the page did not provide one. | 113 // Original page title or nil if the page did not provide one. |
| 115 @property(nonatomic, readonly) NSString* originalTitle; | 114 @property(nonatomic, readonly) NSString* originalTitle; |
| 116 | 115 |
| 117 @property(nonatomic, readonly) NSString* urlDisplayString; | 116 @property(nonatomic, readonly) NSString* urlDisplayString; |
| 118 | 117 |
| 119 // ID associated with this tab. | 118 // ID associated with this tab. |
| 120 @property(nonatomic, readonly) NSString* tabId; | 119 @property(nonatomic, readonly) NSString* tabId; |
| 121 | 120 |
| 122 // ID of the opener of this tab. | |
| 123 @property(nonatomic, readonly) NSString* openerID; | |
| 124 | |
| 125 // NavigationIndex of the opener of this tab. | |
| 126 @property(nonatomic, readonly) NSInteger openerNavigationIndex; | |
| 127 | |
| 128 // |YES| if snapshot overlay should load from the grey image cache. | 121 // |YES| if snapshot overlay should load from the grey image cache. |
| 129 @property(nonatomic, assign) BOOL useGreyImageCache; | 122 @property(nonatomic, assign) BOOL useGreyImageCache; |
| 130 | 123 |
| 131 // The Webstate associated with this Tab. | 124 // The Webstate associated with this Tab. |
| 132 @property(nonatomic, readonly) web::WebState* webState; | 125 @property(nonatomic, readonly) web::WebState* webState; |
| 133 | 126 |
| 134 @property(nonatomic, readonly) CRWWebController* webController; | 127 @property(nonatomic, readonly) CRWWebController* webController; |
| 135 @property(nonatomic, readonly) PasswordController* passwordController; | 128 @property(nonatomic, readonly) PasswordController* passwordController; |
| 136 @property(nonatomic, readonly) BOOL canGoBack; | 129 @property(nonatomic, readonly) BOOL canGoBack; |
| 137 @property(nonatomic, readonly) BOOL canGoForward; | 130 @property(nonatomic, readonly) BOOL canGoForward; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 159 | 152 |
| 160 // TODO(crbug.com/661663): Should this property abstract away the concept of | 153 // TODO(crbug.com/661663): Should this property abstract away the concept of |
| 161 // prerendering? Maybe this can move to the TabDelegate interface. | 154 // prerendering? Maybe this can move to the TabDelegate interface. |
| 162 @property(nonatomic, assign) BOOL isPrerenderTab; | 155 @property(nonatomic, assign) BOOL isPrerenderTab; |
| 163 @property(nonatomic, assign) BOOL isLinkLoadingPrerenderTab; | 156 @property(nonatomic, assign) BOOL isLinkLoadingPrerenderTab; |
| 164 @property(nonatomic, assign) BOOL isVoiceSearchResultsTab; | 157 @property(nonatomic, assign) BOOL isVoiceSearchResultsTab; |
| 165 | 158 |
| 166 // |YES| if the tab has finished loading. | 159 // |YES| if the tab has finished loading. |
| 167 @property(nonatomic, readonly) BOOL loadFinished; | 160 @property(nonatomic, readonly) BOOL loadFinished; |
| 168 | 161 |
| 169 // Creates a new tab with the given state. |opener| is nil unless another tab | 162 // Creates a new Tab with the given WebState. |
| 170 // is conceptually the parent of this tab. |openedByDOM| is YES if the page was | 163 - (instancetype)initWithWebState:(web::WebState*)webState; |
| 171 // opened by DOM. |model| and |browserState| must not be nil. | |
| 172 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState | |
| 173 opener:(Tab*)opener | |
| 174 openedByDOM:(BOOL)openedByDOM | |
| 175 model:(TabModel*)parentModel; | |
| 176 | |
| 177 // Create a new tab with given web state and tab model. All must be non-nil. | |
| 178 - (instancetype)initWithWebState:(std::unique_ptr<web::WebState>)webState | |
| 179 model:(TabModel*)parentModel; | |
| 180 | |
| 181 // Create a new tab with given web state and tab model, optionally attaching | |
| 182 // the tab helpers (controlled by |attachTabHelpers|). All must be non-nil. | |
| 183 - (instancetype)initWithWebState:(std::unique_ptr<web::WebState>)webState | |
| 184 model:(TabModel*)parentModel | |
| 185 attachTabHelpers:(BOOL)attachTabHelpers | |
| 186 NS_DESIGNATED_INITIALIZER; | |
| 187 | 164 |
| 188 - (instancetype)init NS_UNAVAILABLE; | 165 - (instancetype)init NS_UNAVAILABLE; |
| 189 | 166 |
| 190 // Creates a new Tab instance loading |url| with |transition|, configured | |
| 191 // with no TabModel. |opener| may be nil, and behaves exactly as for | |
| 192 // -initWithBrowserState:opener:openedByDOM:model. |configuration| is a block | |
| 193 // that will be run before |url| starts loading, and is the correct place to set | |
| 194 // properties and delegates on the tab. Calling code must take ownership of the | |
| 195 // tab -- this is particularly important with Tab instances, because they will | |
| 196 // fail a DCHECK if they are deallocated without -close being called. | |
| 197 + (Tab*)preloadingTabWithBrowserState:(ios::ChromeBrowserState*)browserState | |
| 198 url:(const GURL&)url | |
| 199 referrer:(const web::Referrer&)referrer | |
| 200 transition:(ui::PageTransition)transition | |
| 201 provider:(id<CRWNativeContentProvider>)provider | |
| 202 opener:(Tab*)opener | |
| 203 desktopUserAgent:(BOOL)desktopUserAgent | |
| 204 configuration:(void (^)(Tab*))configuration; | |
| 205 | |
| 206 // Sets the parent tab model for this tab. Can only be called if the tab does | 167 // Sets the parent tab model for this tab. Can only be called if the tab does |
| 207 // not already have a parent tab model set. | 168 // not already have a parent tab model set. |
| 208 // TODO(crbug.com/228575): Create a delegate interface and remove this. | 169 // TODO(crbug.com/228575): Create a delegate interface and remove this. |
| 209 - (void)setParentTabModel:(TabModel*)model; | 170 - (void)setParentTabModel:(TabModel*)model; |
| 210 | 171 |
| 211 // Replace the content of the tab with the content described by |SessionTab|. | 172 // Replace the content of the tab with the content described by |SessionTab|. |
| 212 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab; | 173 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab; |
| 213 | 174 |
| 214 // Stop the page loading. | 175 // Stop the page loading. |
| 215 // Equivalent to the user pressing 'stop', or a window.stop() command. | 176 // Equivalent to the user pressing 'stop', or a window.stop() command. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 230 | 191 |
| 231 // The view that generates print data when printing. It can be nil when printing | 192 // The view that generates print data when printing. It can be nil when printing |
| 232 // is not supported with this tab. It can be different from |Tab view|. | 193 // is not supported with this tab. It can be different from |Tab view|. |
| 233 - (UIView*)viewForPrinting; | 194 - (UIView*)viewForPrinting; |
| 234 | 195 |
| 235 // Halts the tab's network activity without closing it. This should only be | 196 // Halts the tab's network activity without closing it. This should only be |
| 236 // called during shutdown, since the tab will be unusable but still present | 197 // called during shutdown, since the tab will be unusable but still present |
| 237 // after this method completes. | 198 // after this method completes. |
| 238 - (void)terminateNetworkActivity; | 199 - (void)terminateNetworkActivity; |
| 239 | 200 |
| 240 // Starts the tab's shutdown sequence. | |
| 241 - (void)close; | |
| 242 | |
| 243 // Dismisses all modals owned by the tab. | 201 // Dismisses all modals owned by the tab. |
| 244 - (void)dismissModals; | 202 - (void)dismissModals; |
| 245 | 203 |
| 246 // Returns the NavigationManager for this tab's WebState. Requires WebState to | 204 // Returns the NavigationManager for this tab's WebState. Requires WebState to |
| 247 // be populated. Can return null. | 205 // be populated. Can return null. |
| 248 // TODO(crbug.com/620465): remove navigationManagerImpl once Tab no longer uses | 206 // TODO(crbug.com/620465): remove navigationManagerImpl once Tab no longer uses |
| 249 // nor exposes private ios/web/ API. | 207 // nor exposes private ios/web/ API. |
| 250 - (web::NavigationManager*)navigationManager; | 208 - (web::NavigationManager*)navigationManager; |
| 251 - (web::NavigationManagerImpl*)navigationManagerImpl; | 209 - (web::NavigationManagerImpl*)navigationManagerImpl; |
| 252 | 210 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 303 |
| 346 // Called when this tab is hidden. | 304 // Called when this tab is hidden. |
| 347 - (void)wasHidden; | 305 - (void)wasHidden; |
| 348 | 306 |
| 349 // Evaluates U2F result. | 307 // Evaluates U2F result. |
| 350 - (void)evaluateU2FResultFromURL:(const GURL&)url; | 308 - (void)evaluateU2FResultFromURL:(const GURL&)url; |
| 351 | 309 |
| 352 @end | 310 @end |
| 353 | 311 |
| 354 #endif // IOS_CHROME_BROWSER_TABS_TAB_H_ | 312 #endif // IOS_CHROME_BROWSER_TABS_TAB_H_ |
| OLD | NEW |