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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void ShowTransientContentView(CRWContentView* content_view) override; | 226 void ShowTransientContentView(CRWContentView* content_view) override; |
227 bool IsShowingWebInterstitial() const override; | 227 bool IsShowingWebInterstitial() const override; |
228 WebInterstitial* GetWebInterstitial() const override; | 228 WebInterstitial* GetWebInterstitial() const override; |
229 void OnPasswordInputShownOnHttp() override; | 229 void OnPasswordInputShownOnHttp() override; |
230 void OnCreditCardInputShownOnHttp() override; | 230 void OnCreditCardInputShownOnHttp() override; |
231 void AddScriptCommandCallback(const ScriptCommandCallback& callback, | 231 void AddScriptCommandCallback(const ScriptCommandCallback& callback, |
232 const std::string& command_prefix) override; | 232 const std::string& command_prefix) override; |
233 void RemoveScriptCommandCallback(const std::string& command_prefix) override; | 233 void RemoveScriptCommandCallback(const std::string& command_prefix) override; |
234 id<CRWWebViewProxy> GetWebViewProxy() const override; | 234 id<CRWWebViewProxy> GetWebViewProxy() const override; |
235 service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override; | 235 service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override; |
| 236 bool IsOpenedByDOM() const override; |
236 base::WeakPtr<WebState> AsWeakPtr() override; | 237 base::WeakPtr<WebState> AsWeakPtr() override; |
237 | 238 |
238 // Adds |interstitial|'s view to the web controller's content view. | 239 // Adds |interstitial|'s view to the web controller's content view. |
239 void ShowWebInterstitial(WebInterstitialImpl* interstitial); | 240 void ShowWebInterstitial(WebInterstitialImpl* interstitial); |
240 | 241 |
241 // Called to dismiss the currently-displayed transient content view. | 242 // Called to dismiss the currently-displayed transient content view. |
242 void ClearTransientContentView(); | 243 void ClearTransientContentView(); |
243 | 244 |
244 // Notifies the delegate that the load progress was updated. | 245 // Notifies the delegate that the load progress was updated. |
245 void SendChangeLoadProgress(double progress); | 246 void SendChangeLoadProgress(double progress); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 354 |
354 // Weak pointer to the interstitial page being displayed, if any. | 355 // Weak pointer to the interstitial page being displayed, if any. |
355 WebInterstitialImpl* interstitial_; | 356 WebInterstitialImpl* interstitial_; |
356 | 357 |
357 // Returned by reference. | 358 // Returned by reference. |
358 base::string16 empty_string16_; | 359 base::string16 empty_string16_; |
359 | 360 |
360 // Callbacks associated to command prefixes. | 361 // Callbacks associated to command prefixes. |
361 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; | 362 std::map<std::string, ScriptCommandCallback> script_command_callbacks_; |
362 | 363 |
| 364 // Whether this WebState is associated with a session opened via window.open. |
| 365 bool opened_by_dom_; |
| 366 |
363 // Member variables should appear before the WeakPtrFactory<> to ensure that | 367 // Member variables should appear before the WeakPtrFactory<> to ensure that |
364 // any WeakPtrs to WebStateImpl are invalidated before its member variable's | 368 // any WeakPtrs to WebStateImpl are invalidated before its member variable's |
365 // destructors are executed, rendering them invalid. | 369 // destructors are executed, rendering them invalid. |
366 base::WeakPtrFactory<WebState> weak_factory_; | 370 base::WeakPtrFactory<WebState> weak_factory_; |
367 | 371 |
368 // Mojo interface registry for this WebState. | 372 // Mojo interface registry for this WebState. |
369 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; | 373 std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_; |
370 | 374 |
371 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); | 375 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); |
372 }; | 376 }; |
373 | 377 |
374 } // namespace web | 378 } // namespace web |
375 | 379 |
376 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 380 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
OLD | NEW |