| 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_PUBLIC_WEB_STATE_WEB_STATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
| 16 #include "ios/web/public/referrer.h" | 16 #include "ios/web/public/referrer.h" |
| 17 #include "ios/web/public/web_state/url_verification_constants.h" | 17 #include "ios/web/public/web_state/url_verification_constants.h" |
| 18 #include "ui/base/page_transition_types.h" | 18 #include "ui/base/page_transition_types.h" |
| 19 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 class GURL; | 23 class GURL; |
| 24 class SkBitmap; | 24 class SkBitmap; |
| 25 | 25 |
| 26 @class CRWJSInjectionReceiver; | 26 @class CRWJSInjectionReceiver; |
| 27 @class CRWNavigationManagerStorage; | 27 @class CRWSessionStorage; |
| 28 @protocol CRWScrollableContent; | 28 @protocol CRWScrollableContent; |
| 29 @protocol CRWWebViewProxy; | 29 @protocol CRWWebViewProxy; |
| 30 typedef id<CRWWebViewProxy> CRWWebViewProxyType; | 30 typedef id<CRWWebViewProxy> CRWWebViewProxyType; |
| 31 @class UIView; | 31 @class UIView; |
| 32 typedef UIView<CRWScrollableContent> CRWContentView; | 32 typedef UIView<CRWScrollableContent> CRWContentView; |
| 33 | 33 |
| 34 namespace base { | 34 namespace base { |
| 35 class DictionaryValue; | 35 class DictionaryValue; |
| 36 class Value; | 36 class Value; |
| 37 } | 37 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 /* The sizes in pixel of the bitmaps before they were resized due to the | 93 /* The sizes in pixel of the bitmaps before they were resized due to the |
| 94 max bitmap size passed to DownloadImage(). Each entry in the bitmaps | 94 max bitmap size passed to DownloadImage(). Each entry in the bitmaps |
| 95 vector corresponds to an entry in the sizes vector. If a bitmap was | 95 vector corresponds to an entry in the sizes vector. If a bitmap was |
| 96 resized, there should be a single returned bitmap. */ | 96 resized, there should be a single returned bitmap. */ |
| 97 const std::vector<gfx::Size>&)> | 97 const std::vector<gfx::Size>&)> |
| 98 ImageDownloadCallback; | 98 ImageDownloadCallback; |
| 99 | 99 |
| 100 // Creates a new WebState. | 100 // Creates a new WebState. |
| 101 static std::unique_ptr<WebState> Create(const CreateParams& params); | 101 static std::unique_ptr<WebState> Create(const CreateParams& params); |
| 102 // Creates a new WebState from a serialized NavigationManager. | 102 // Creates a new WebState from a serialized NavigationManager. |
| 103 static std::unique_ptr<WebState> Create( | 103 static std::unique_ptr<WebState> Create(const CreateParams& params, |
| 104 const CreateParams& params, | 104 CRWSessionStorage* session_storage); |
| 105 CRWNavigationManagerStorage* session_storage); | |
| 106 | 105 |
| 107 ~WebState() override {} | 106 ~WebState() override {} |
| 108 | 107 |
| 109 // Gets/Sets the delegate. | 108 // Gets/Sets the delegate. |
| 110 virtual WebStateDelegate* GetDelegate() = 0; | 109 virtual WebStateDelegate* GetDelegate() = 0; |
| 111 virtual void SetDelegate(WebStateDelegate* delegate) = 0; | 110 virtual void SetDelegate(WebStateDelegate* delegate) = 0; |
| 112 | 111 |
| 113 // Whether or not a web view is allowed to exist in this WebState. Defaults | 112 // Whether or not a web view is allowed to exist in this WebState. Defaults |
| 114 // to false; this should be enabled before attempting to access the view. | 113 // to false; this should be enabled before attempting to access the view. |
| 115 virtual bool IsWebUsageEnabled() const = 0; | 114 virtual bool IsWebUsageEnabled() const = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 133 virtual void OpenURL(const OpenURLParams& params) = 0; | 132 virtual void OpenURL(const OpenURLParams& params) = 0; |
| 134 | 133 |
| 135 // Stops any pending navigation. | 134 // Stops any pending navigation. |
| 136 virtual void Stop() = 0; | 135 virtual void Stop() = 0; |
| 137 | 136 |
| 138 // Gets the NavigationManager associated with this WebState. Can never return | 137 // Gets the NavigationManager associated with this WebState. Can never return |
| 139 // null. | 138 // null. |
| 140 virtual const NavigationManager* GetNavigationManager() const = 0; | 139 virtual const NavigationManager* GetNavigationManager() const = 0; |
| 141 virtual NavigationManager* GetNavigationManager() = 0; | 140 virtual NavigationManager* GetNavigationManager() = 0; |
| 142 | 141 |
| 143 // Creates a serialized version of the NavigationManager. The returned value | 142 // Creates a serializable representation of the session. The returned value |
| 144 // is autoreleased. | 143 // is autoreleased. |
| 145 virtual CRWNavigationManagerStorage* BuildSerializedNavigationManager() = 0; | 144 virtual CRWSessionStorage* BuildSessionStorage() = 0; |
| 146 | 145 |
| 147 // Gets the CRWJSInjectionReceiver associated with this WebState. | 146 // Gets the CRWJSInjectionReceiver associated with this WebState. |
| 148 virtual CRWJSInjectionReceiver* GetJSInjectionReceiver() const = 0; | 147 virtual CRWJSInjectionReceiver* GetJSInjectionReceiver() const = 0; |
| 149 | 148 |
| 150 // Runs JavaScript in the main frame's context. If a callback is provided, it | 149 // Runs JavaScript in the main frame's context. If a callback is provided, it |
| 151 // will be used to return the result, when the result is available or script | 150 // will be used to return the result, when the result is available or script |
| 152 // execution has failed due to an error. | 151 // execution has failed due to an error. |
| 153 // NOTE: Integer values will be returned as Type::DOUBLE because of underlying | 152 // NOTE: Integer values will be returned as Type::DOUBLE because of underlying |
| 154 // library limitation. | 153 // library limitation. |
| 155 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; | 154 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 286 |
| 288 // Returns a WeakPtr<WebState> to the current WebState. Must remain private | 287 // Returns a WeakPtr<WebState> to the current WebState. Must remain private |
| 289 // and only call must be in WebStateWeakPtrFactory. Please consult that class | 288 // and only call must be in WebStateWeakPtrFactory. Please consult that class |
| 290 // for more details. Remove as part of http://crbug.com/556736. | 289 // for more details. Remove as part of http://crbug.com/556736. |
| 291 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; | 290 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; |
| 292 }; | 291 }; |
| 293 | 292 |
| 294 } // namespace web | 293 } // namespace web |
| 295 | 294 |
| 296 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ | 295 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| OLD | NEW |