| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #import "ios/web/navigation/navigation_manager_delegate.h" | 20 #import "ios/web/navigation/navigation_manager_delegate.h" |
| 21 #import "ios/web/navigation/navigation_manager_impl.h" | 21 #import "ios/web/navigation/navigation_manager_impl.h" |
| 22 #import "ios/web/public/java_script_dialog_callback.h" | 22 #import "ios/web/public/java_script_dialog_callback.h" |
| 23 #include "ios/web/public/java_script_dialog_type.h" | 23 #include "ios/web/public/java_script_dialog_type.h" |
| 24 #import "ios/web/public/web_state/web_state.h" | 24 #import "ios/web/public/web_state/web_state.h" |
| 25 #import "ios/web/public/web_state/web_state_delegate.h" | 25 #import "ios/web/public/web_state/web_state_delegate.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 @class CRWNavigationManagerStorage; | 28 @class CRWSessionStorage; |
| 29 @class CRWWebController; | 29 @class CRWWebController; |
| 30 @protocol CRWWebViewProxy; | 30 @protocol CRWWebViewProxy; |
| 31 @class NSURLRequest; | 31 @class NSURLRequest; |
| 32 @class NSURLResponse; | 32 @class NSURLResponse; |
| 33 | 33 |
| 34 namespace net { | 34 namespace net { |
| 35 class HttpResponseHeaders; | 35 class HttpResponseHeaders; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace web { | 38 namespace web { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 // in preparation for saving. | 59 // in preparation for saving. |
| 60 // - WebControllers are the eventual long-term owners of WebStateImpls. | 60 // - WebControllers are the eventual long-term owners of WebStateImpls. |
| 61 // - SessionWindows are transient owners, passing ownership into WebControllers | 61 // - SessionWindows are transient owners, passing ownership into WebControllers |
| 62 // during session restore, and discarding owned copies of WebStateImpls after | 62 // during session restore, and discarding owned copies of WebStateImpls after |
| 63 // writing them out for session saves. | 63 // writing them out for session saves. |
| 64 class WebStateImpl : public WebState, public NavigationManagerDelegate { | 64 class WebStateImpl : public WebState, public NavigationManagerDelegate { |
| 65 public: | 65 public: |
| 66 // Constructor for WebStateImpls created for new sessions. | 66 // Constructor for WebStateImpls created for new sessions. |
| 67 WebStateImpl(BrowserState* browser_state); | 67 WebStateImpl(BrowserState* browser_state); |
| 68 // Constructor for WebStatesImpls created for deserialized sessions | 68 // Constructor for WebStatesImpls created for deserialized sessions |
| 69 WebStateImpl(BrowserState* browser_state, | 69 WebStateImpl(BrowserState* browser_state, CRWSessionStorage* session_storage); |
| 70 CRWNavigationManagerStorage* session_storage); | |
| 71 ~WebStateImpl() override; | 70 ~WebStateImpl() override; |
| 72 | 71 |
| 73 // Gets/Sets the CRWWebController that backs this object. | 72 // Gets/Sets the CRWWebController that backs this object. |
| 74 CRWWebController* GetWebController(); | 73 CRWWebController* GetWebController(); |
| 75 void SetWebController(CRWWebController* web_controller); | 74 void SetWebController(CRWWebController* web_controller); |
| 76 | 75 |
| 77 // Gets or sets the delegate used to communicate with the web contents facade. | 76 // Gets or sets the delegate used to communicate with the web contents facade. |
| 78 WebStateFacadeDelegate* GetFacadeDelegate() const; | 77 WebStateFacadeDelegate* GetFacadeDelegate() const; |
| 79 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); | 78 void SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate); |
| 80 | 79 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 bool IsWebUsageEnabled() const override; | 196 bool IsWebUsageEnabled() const override; |
| 198 void SetWebUsageEnabled(bool enabled) override; | 197 void SetWebUsageEnabled(bool enabled) override; |
| 199 bool ShouldSuppressDialogs() const override; | 198 bool ShouldSuppressDialogs() const override; |
| 200 void SetShouldSuppressDialogs(bool should_suppress) override; | 199 void SetShouldSuppressDialogs(bool should_suppress) override; |
| 201 UIView* GetView() override; | 200 UIView* GetView() override; |
| 202 BrowserState* GetBrowserState() const override; | 201 BrowserState* GetBrowserState() const override; |
| 203 void OpenURL(const WebState::OpenURLParams& params) override; | 202 void OpenURL(const WebState::OpenURLParams& params) override; |
| 204 void Stop() override; | 203 void Stop() override; |
| 205 const NavigationManager* GetNavigationManager() const override; | 204 const NavigationManager* GetNavigationManager() const override; |
| 206 NavigationManager* GetNavigationManager() override; | 205 NavigationManager* GetNavigationManager() override; |
| 207 CRWNavigationManagerStorage* BuildSerializedNavigationManager() override; | 206 CRWSessionStorage* BuildSessionStorage() override; |
| 208 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | 207 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; |
| 209 void ExecuteJavaScript(const base::string16& javascript) override; | 208 void ExecuteJavaScript(const base::string16& javascript) override; |
| 210 void ExecuteJavaScript(const base::string16& javascript, | 209 void ExecuteJavaScript(const base::string16& javascript, |
| 211 const JavaScriptResultCallback& callback) override; | 210 const JavaScriptResultCallback& callback) override; |
| 212 const std::string& GetContentLanguageHeader() const override; | 211 const std::string& GetContentLanguageHeader() const override; |
| 213 const std::string& GetContentsMimeType() const override; | 212 const std::string& GetContentsMimeType() const override; |
| 214 bool ContentIsHTML() const override; | 213 bool ContentIsHTML() const override; |
| 215 const base::string16& GetTitle() const override; | 214 const base::string16& GetTitle() const override; |
| 216 bool IsLoading() const override; | 215 bool IsLoading() const override; |
| 217 double GetLoadingProgress() const override; | 216 double GetLoadingProgress() const override; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 const LoadCommittedDetails& load_details) override; | 274 const LoadCommittedDetails& load_details) override; |
| 276 WebState* GetWebState() override; | 275 WebState* GetWebState() override; |
| 277 | 276 |
| 278 protected: | 277 protected: |
| 279 void AddObserver(WebStateObserver* observer) override; | 278 void AddObserver(WebStateObserver* observer) override; |
| 280 void RemoveObserver(WebStateObserver* observer) override; | 279 void RemoveObserver(WebStateObserver* observer) override; |
| 281 void AddPolicyDecider(WebStatePolicyDecider* decider) override; | 280 void AddPolicyDecider(WebStatePolicyDecider* decider) override; |
| 282 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; | 281 void RemovePolicyDecider(WebStatePolicyDecider* decider) override; |
| 283 | 282 |
| 284 private: | 283 private: |
| 284 // The SessionStorageBuilder functions require access to private variables of |
| 285 // WebStateImpl. |
| 286 friend SessionStorageBuilder; |
| 287 |
| 285 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns | 288 // Creates a WebUIIOS object for |url| that is owned by the caller. Returns |
| 286 // nullptr if |url| does not correspond to a WebUI page. | 289 // nullptr if |url| does not correspond to a WebUI page. |
| 287 std::unique_ptr<web::WebUIIOS> CreateWebUIIOS(const GURL& url); | 290 std::unique_ptr<web::WebUIIOS> CreateWebUIIOS(const GURL& url); |
| 288 | 291 |
| 289 // Updates the HTTP response headers for the main page using the headers | 292 // Updates the HTTP response headers for the main page using the headers |
| 290 // passed to the OnHttpResponseHeadersReceived() function below. | 293 // passed to the OnHttpResponseHeadersReceived() function below. |
| 291 // GetHttpResponseHeaders() can be used to get the headers. | 294 // GetHttpResponseHeaders() can be used to get the headers. |
| 292 void UpdateHttpResponseHeaders(const GURL& url); | 295 void UpdateHttpResponseHeaders(const GURL& url); |
| 293 | 296 |
| 294 // Returns true if |web_controller_| has been set. | 297 // Returns true if |web_controller_| has been set. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 357 |
| 355 // Image Fetcher used to images. | 358 // Image Fetcher used to images. |
| 356 std::unique_ptr<ImageDataFetcher> image_fetcher_; | 359 std::unique_ptr<ImageDataFetcher> image_fetcher_; |
| 357 | 360 |
| 358 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); | 361 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); |
| 359 }; | 362 }; |
| 360 | 363 |
| 361 } // namespace web | 364 } // namespace web |
| 362 | 365 |
| 363 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ | 366 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ |
| OLD | NEW |