| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // (b) By @SessionWindow, when decoding a saved session. | 56 // (b) By @SessionWindow, when decoding a saved session. |
| 57 // (c) By the Copy() method, below, used when marshalling a session | 57 // (c) By the Copy() method, below, used when marshalling a session |
| 58 // in preparation for saving. | 58 // in preparation for saving. |
| 59 // - WebControllers are the eventual long-term owners of WebStateImpls. | 59 // - WebControllers are the eventual long-term owners of WebStateImpls. |
| 60 // - SessionWindows are transient owners, passing ownership into WebControllers | 60 // - SessionWindows are transient owners, passing ownership into WebControllers |
| 61 // during session restore, and discarding owned copies of WebStateImpls after | 61 // during session restore, and discarding owned copies of WebStateImpls after |
| 62 // writing them out for session saves. | 62 // writing them out for session saves. |
| 63 class WebStateImpl : public WebState, public NavigationManagerDelegate { | 63 class WebStateImpl : public WebState, public NavigationManagerDelegate { |
| 64 public: | 64 public: |
| 65 // Constructor for WebStateImpls created for new sessions. | 65 // Constructor for WebStateImpls created for new sessions. |
| 66 WebStateImpl(BrowserState* browser_state); | 66 WebStateImpl(const CreateParams& params); |
| 67 // Constructor for WebStatesImpls created for deserialized sessions | 67 // Constructor for WebStatesImpls created for deserialized sessions |
| 68 WebStateImpl(BrowserState* browser_state, CRWSessionStorage* session_storage); | 68 WebStateImpl(const CreateParams& params, CRWSessionStorage* session_storage); |
| 69 ~WebStateImpl() override; | 69 ~WebStateImpl() override; |
| 70 | 70 |
| 71 // Gets/Sets the CRWWebController that backs this object. | 71 // Gets/Sets the CRWWebController that backs this object. |
| 72 CRWWebController* GetWebController(); | 72 CRWWebController* GetWebController(); |
| 73 void SetWebController(CRWWebController* web_controller); | 73 void SetWebController(CRWWebController* web_controller); |
| 74 | 74 |
| 75 // Gets or sets the delegate used to communicate with the web contents facade. | 75 // Gets or sets the delegate used to communicate with the web contents facade. |
| 76 WebStateFacadeDelegate* GetFacadeDelegate() const; | 76 WebStateFacadeDelegate* GetFacadeDelegate() const; |
| 77 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); | 77 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); |
| 78 | 78 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void ShowTransientContentView(CRWContentView* content_view) override; | 229 void ShowTransientContentView(CRWContentView* content_view) override; |
| 230 bool IsShowingWebInterstitial() const override; | 230 bool IsShowingWebInterstitial() const override; |
| 231 WebInterstitial* GetWebInterstitial() const override; | 231 WebInterstitial* GetWebInterstitial() const override; |
| 232 void OnPasswordInputShownOnHttp() override; | 232 void OnPasswordInputShownOnHttp() override; |
| 233 void OnCreditCardInputShownOnHttp() override; | 233 void OnCreditCardInputShownOnHttp() override; |
| 234 void AddScriptCommandCallback(const ScriptCommandCallback& callback, | 234 void AddScriptCommandCallback(const ScriptCommandCallback& callback, |
| 235 const std::string& command_prefix) override; | 235 const std::string& command_prefix) override; |
| 236 void RemoveScriptCommandCallback(const std::string& command_prefix) override; | 236 void RemoveScriptCommandCallback(const std::string& command_prefix) override; |
| 237 id<CRWWebViewProxy> GetWebViewProxy() const override; | 237 id<CRWWebViewProxy> GetWebViewProxy() const override; |
| 238 service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override; | 238 service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override; |
| 239 bool HasOpener() const override; |
| 239 base::WeakPtr<WebState> AsWeakPtr() override; | 240 base::WeakPtr<WebState> AsWeakPtr() override; |
| 240 | 241 |
| 241 // Adds |interstitial|'s view to the web controller's content view. | 242 // Adds |interstitial|'s view to the web controller's content view. |
| 242 void ShowWebInterstitial(WebInterstitialImpl* interstitial); | 243 void ShowWebInterstitial(WebInterstitialImpl* interstitial); |
| 243 | 244 |
| 244 // Called to dismiss the currently-displayed transient content view. | 245 // Called to dismiss the currently-displayed transient content view. |
| 245 void ClearTransientContentView(); | 246 void ClearTransientContentView(); |
| 246 | 247 |
| 247 // Notifies the delegate that the load progress was updated. | 248 // Notifies the delegate that the load progress was updated. |
| 248 void SendChangeLoadProgress(double progress); | 249 void SendChangeLoadProgress(double progress); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 358 |
| 358 // Weak pointer to the interstitial page being displayed, if any. | 359 // Weak pointer to the interstitial page being displayed, if any. |
| 359 WebInterstitialImpl* interstitial_; | 360 WebInterstitialImpl* interstitial_; |
| 360 | 361 |
| 361 // Returned by reference. | 362 // Returned by reference. |
| 362 base::string16 empty_string16_; | 363 base::string16 empty_string16_; |
| 363 | 364 |
| 364 // Callbacks associated to command prefixes. | 365 // Callbacks associated to command prefixes. |
| 365 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; | 366 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; |
| 366 | 367 |
| 368 // Whether this WebState has an opener. See |
| 369 // WebState::CreateParams::created_with_opener_ for more details. |
| 370 bool created_with_opener_; |
| 371 |
| 367 // Member variables should appear before the WeakPtrFactory<> to ensure that | 372 // Member variables should appear before the WeakPtrFactory<> to ensure that |
| 368 // any WeakPtrs to WebStateImpl are invalidated before its member variable's | 373 // any WeakPtrs to WebStateImpl are invalidated before its member variable's |
| 369 // destructors are executed, rendering them invalid. | 374 // destructors are executed, rendering them invalid. |
| 370 base::WeakPtrFactory<WebState> weak_factory_; | 375 base::WeakPtrFactory<WebState> weak_factory_; |
| 371 | 376 |
| 372 // Mojo interface registry for this WebState. | 377 // Mojo interface registry for this WebState. |
| 373 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; | 378 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; |
| 374 | 379 |
| 375 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); | 380 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); |
| 376 }; | 381 }; |
| 377 | 382 |
| 378 } // namespace web | 383 } // namespace web |
| 379 | 384 |
| 380 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 385 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| OLD | NEW |