| 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_WEB_STATE_WEB_STATE_IMPL_H_ | 5 #ifndef IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| 6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace web { | 36 namespace web { |
| 37 | 37 |
| 38 class BrowserState; | 38 class BrowserState; |
| 39 struct Credential; | 39 struct Credential; |
| 40 struct FaviconURL; | 40 struct FaviconURL; |
| 41 struct LoadCommittedDetails; | 41 struct LoadCommittedDetails; |
| 42 class NavigationManager; | 42 class NavigationManager; |
| 43 class WebInterstitialImpl; | 43 class WebInterstitialImpl; |
| 44 class WebStateDelegate; |
| 44 class WebStateFacadeDelegate; | 45 class WebStateFacadeDelegate; |
| 45 class WebStatePolicyDecider; | 46 class WebStatePolicyDecider; |
| 46 class WebUIIOS; | 47 class WebUIIOS; |
| 47 | 48 |
| 48 // Implementation of WebState. | 49 // Implementation of WebState. |
| 49 // Generally mirrors //content's WebContents implementation. | 50 // Generally mirrors //content's WebContents implementation. |
| 50 // General notes on expected WebStateImpl ownership patterns: | 51 // General notes on expected WebStateImpl ownership patterns: |
| 51 // - Outside of tests, WebStateImpls are created | 52 // - Outside of tests, WebStateImpls are created |
| 52 // (a) By @Tab, when creating a new Tab. | 53 // (a) By @Tab, when creating a new Tab. |
| 53 // (b) By @SessionWindow, when decoding a saved session. | 54 // (b) By @SessionWindow, when decoding a saved session. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 RequestTrackerImpl* GetRequestTracker(); | 209 RequestTrackerImpl* GetRequestTracker(); |
| 209 | 210 |
| 210 // Lazily creates (if necessary) and returns |request_group_id_|. | 211 // Lazily creates (if necessary) and returns |request_group_id_|. |
| 211 // IMPORTANT: This should not be used for anything other than associating this | 212 // IMPORTANT: This should not be used for anything other than associating this |
| 212 // instance to network requests. | 213 // instance to network requests. |
| 213 // This function is only intended to be used in web/. | 214 // This function is only intended to be used in web/. |
| 214 // TODO(stuartmorgan): Move this method in an implementation file in web/. | 215 // TODO(stuartmorgan): Move this method in an implementation file in web/. |
| 215 NSString* GetRequestGroupID(); | 216 NSString* GetRequestGroupID(); |
| 216 | 217 |
| 217 // WebState: | 218 // WebState: |
| 219 WebStateDelegate* GetDelegate() override; |
| 220 void SetDelegate(WebStateDelegate* delegate) override; |
| 218 UIView* GetView() override; | 221 UIView* GetView() override; |
| 219 BrowserState* GetBrowserState() const override; | 222 BrowserState* GetBrowserState() const override; |
| 220 void OpenURL(const WebState::OpenURLParams& params) override; | 223 void OpenURL(const WebState::OpenURLParams& params) override; |
| 221 NavigationManager* GetNavigationManager() override; | 224 NavigationManager* GetNavigationManager() override; |
| 222 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | 225 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; |
| 223 const std::string& GetContentLanguageHeader() const override; | 226 const std::string& GetContentLanguageHeader() const override; |
| 224 const std::string& GetContentsMimeType() const override; | 227 const std::string& GetContentsMimeType() const override; |
| 225 bool ContentIsHTML() const override; | 228 bool ContentIsHTML() const override; |
| 226 const base::string16& GetTitle() const override; | 229 const base::string16& GetTitle() const override; |
| 227 bool IsLoading() const override; | 230 bool IsLoading() const override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 243 bool bypass_cache, | 246 bool bypass_cache, |
| 244 const ImageDownloadCallback& callback) override; | 247 const ImageDownloadCallback& callback) override; |
| 245 base::WeakPtr<WebState> AsWeakPtr() override; | 248 base::WeakPtr<WebState> AsWeakPtr() override; |
| 246 | 249 |
| 247 // Adds |interstitial|'s view to the web controller's content view. | 250 // Adds |interstitial|'s view to the web controller's content view. |
| 248 void ShowWebInterstitial(WebInterstitialImpl* interstitial); | 251 void ShowWebInterstitial(WebInterstitialImpl* interstitial); |
| 249 | 252 |
| 250 // Called to dismiss the currently-displayed transient content view. | 253 // Called to dismiss the currently-displayed transient content view. |
| 251 void ClearTransientContentView(); | 254 void ClearTransientContentView(); |
| 252 | 255 |
| 256 // Notifies the delegate that the load progress was updated. |
| 257 void SendChangeLoadProgress(double progress); |
| 258 |
| 253 // NavigationManagerDelegate: | 259 // NavigationManagerDelegate: |
| 254 void NavigateToPendingEntry() override; | 260 void NavigateToPendingEntry() override; |
| 255 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; | 261 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; |
| 256 void OnNavigationItemsPruned(size_t pruned_item_count) override; | 262 void OnNavigationItemsPruned(size_t pruned_item_count) override; |
| 257 void OnNavigationItemChanged() override; | 263 void OnNavigationItemChanged() override; |
| 258 void OnNavigationItemCommitted( | 264 void OnNavigationItemCommitted( |
| 259 const LoadCommittedDetails& load_details) override; | 265 const LoadCommittedDetails& load_details) override; |
| 260 WebState* GetWebState() override; | 266 WebState* GetWebState() override; |
| 261 | 267 |
| 262 protected: | 268 protected: |
| 263 void AddObserver(WebStateObserver* observer) override; | 269 void AddObserver(WebStateObserver* observer) override; |
| 264 void RemoveObserver(WebStateObserver* observer) override; | 270 void RemoveObserver(WebStateObserver* observer) override; |
| 265 void AddPolicyDecider(WebStatePolicyDecider* decider) override; | 271 void AddPolicyDecider(WebStatePolicyDecider* decider) override; |
| 266 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; | 272 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; |
| 267 | 273 |
| 268 private: | 274 private: |
| 269 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns | 275 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns |
| 270 // nullptr if |url| does not correspond to a WebUI page. | 276 // nullptr if |url| does not correspond to a WebUI page. |
| 271 WebUIIOS* CreateWebUIIOS(const GURL& url); | 277 WebUIIOS* CreateWebUIIOS(const GURL& url); |
| 272 | 278 |
| 273 // Updates the HTTP response headers for the main page using the headers | 279 // Updates the HTTP response headers for the main page using the headers |
| 274 // passed to the OnHttpResponseHeadersReceived() function below. | 280 // passed to the OnHttpResponseHeadersReceived() function below. |
| 275 // GetHttpResponseHeaders() can be used to get the headers. | 281 // GetHttpResponseHeaders() can be used to get the headers. |
| 276 void UpdateHttpResponseHeaders(const GURL& url); | 282 void UpdateHttpResponseHeaders(const GURL& url); |
| 277 | 283 |
| 278 // Returns true if |web_controller_| has been set. | 284 // Returns true if |web_controller_| has been set. |
| 279 bool Configured() const; | 285 bool Configured() const; |
| 280 | 286 |
| 287 // Delegate, not owned by this object. |
| 288 WebStateDelegate* delegate_; |
| 289 |
| 281 // Stores whether the web state is currently loading a page. | 290 // Stores whether the web state is currently loading a page. |
| 282 bool is_loading_; | 291 bool is_loading_; |
| 283 | 292 |
| 284 // Stores whether the web state is currently being destroyed. | 293 // Stores whether the web state is currently being destroyed. |
| 285 bool is_being_destroyed_; | 294 bool is_being_destroyed_; |
| 286 | 295 |
| 287 // The delegate used to pass state to the web contents facade. | 296 // The delegate used to pass state to the web contents facade. |
| 288 WebStateFacadeDelegate* facade_delegate_; | 297 WebStateFacadeDelegate* facade_delegate_; |
| 289 | 298 |
| 290 // The CRWWebController that backs this object. | 299 // The CRWWebController that backs this object. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // any WeakPtrs to WebStateImpl are invalidated before its member variable's | 345 // any WeakPtrs to WebStateImpl are invalidated before its member variable's |
| 337 // destructors are executed, rendering them invalid. | 346 // destructors are executed, rendering them invalid. |
| 338 base::WeakPtrFactory<WebState> weak_factory_; | 347 base::WeakPtrFactory<WebState> weak_factory_; |
| 339 | 348 |
| 340 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); | 349 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); |
| 341 }; | 350 }; |
| 342 | 351 |
| 343 } // namespace web | 352 } // namespace web |
| 344 | 353 |
| 345 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 354 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| OLD | NEW |