| 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 @protocol CRWScrollableContent; | 28 @protocol CRWScrollableContent; |
| 28 @protocol CRWWebViewProxy; | 29 @protocol CRWWebViewProxy; |
| 29 typedef id<CRWWebViewProxy> CRWWebViewProxyType; | 30 typedef id<CRWWebViewProxy> CRWWebViewProxyType; |
| 30 @class UIView; | 31 @class UIView; |
| 31 typedef UIView<CRWScrollableContent> CRWContentView; | 32 typedef UIView<CRWScrollableContent> CRWContentView; |
| 32 | 33 |
| 33 namespace base { | 34 namespace base { |
| 34 class DictionaryValue; | 35 class DictionaryValue; |
| 35 class Value; | 36 class Value; |
| 36 } | 37 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const std::vector<SkBitmap>&, /* bitmaps */ | 92 const std::vector<SkBitmap>&, /* bitmaps */ |
| 92 /* 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 |
| 93 max bitmap size passed to DownloadImage(). Each entry in the bitmaps | 94 max bitmap size passed to DownloadImage(). Each entry in the bitmaps |
| 94 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 |
| 95 resized, there should be a single returned bitmap. */ | 96 resized, there should be a single returned bitmap. */ |
| 96 const std::vector<gfx::Size>&)> | 97 const std::vector<gfx::Size>&)> |
| 97 ImageDownloadCallback; | 98 ImageDownloadCallback; |
| 98 | 99 |
| 99 // Creates a new WebState. | 100 // Creates a new WebState. |
| 100 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. |
| 103 static std::unique_ptr<WebState> Create( |
| 104 const CreateParams& params, |
| 105 CRWNavigationManagerStorage* session_storage); |
| 101 | 106 |
| 102 ~WebState() override {} | 107 ~WebState() override {} |
| 103 | 108 |
| 104 // Gets/Sets the delegate. | 109 // Gets/Sets the delegate. |
| 105 virtual WebStateDelegate* GetDelegate() = 0; | 110 virtual WebStateDelegate* GetDelegate() = 0; |
| 106 virtual void SetDelegate(WebStateDelegate* delegate) = 0; | 111 virtual void SetDelegate(WebStateDelegate* delegate) = 0; |
| 107 | 112 |
| 108 // Whether or not a web view is allowed to exist in this WebState. Defaults | 113 // Whether or not a web view is allowed to exist in this WebState. Defaults |
| 109 // to false; this should be enabled before attempting to access the view. | 114 // to false; this should be enabled before attempting to access the view. |
| 110 virtual bool IsWebUsageEnabled() const = 0; | 115 virtual bool IsWebUsageEnabled() const = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 128 virtual void OpenURL(const OpenURLParams& params) = 0; | 133 virtual void OpenURL(const OpenURLParams& params) = 0; |
| 129 | 134 |
| 130 // Stops any pending navigation. | 135 // Stops any pending navigation. |
| 131 virtual void Stop() = 0; | 136 virtual void Stop() = 0; |
| 132 | 137 |
| 133 // Gets the NavigationManager associated with this WebState. Can never return | 138 // Gets the NavigationManager associated with this WebState. Can never return |
| 134 // null. | 139 // null. |
| 135 virtual const NavigationManager* GetNavigationManager() const = 0; | 140 virtual const NavigationManager* GetNavigationManager() const = 0; |
| 136 virtual NavigationManager* GetNavigationManager() = 0; | 141 virtual NavigationManager* GetNavigationManager() = 0; |
| 137 | 142 |
| 143 // Creates a serialized version of the NavigationManager. The returned value |
| 144 // is autoreleased. |
| 145 virtual CRWNavigationManagerStorage* BuildSerializedNavigationManager() = 0; |
| 146 |
| 138 // Gets the CRWJSInjectionReceiver associated with this WebState. | 147 // Gets the CRWJSInjectionReceiver associated with this WebState. |
| 139 virtual CRWJSInjectionReceiver* GetJSInjectionReceiver() const = 0; | 148 virtual CRWJSInjectionReceiver* GetJSInjectionReceiver() const = 0; |
| 140 | 149 |
| 141 // Runs JavaScript in the main frame's context. If a callback is provided, it | 150 // Runs JavaScript in the main frame's context. If a callback is provided, it |
| 142 // will be used to return the result, when the result is available or script | 151 // will be used to return the result, when the result is available or script |
| 143 // execution has failed due to an error. | 152 // execution has failed due to an error. |
| 144 // NOTE: Integer values will be returned as Type::DOUBLE because of underlying | 153 // NOTE: Integer values will be returned as Type::DOUBLE because of underlying |
| 145 // library limitation. | 154 // library limitation. |
| 146 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; | 155 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; |
| 147 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; | 156 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 281 |
| 273 // Returns a WeakPtr<WebState> to the current WebState. Must remain private | 282 // Returns a WeakPtr<WebState> to the current WebState. Must remain private |
| 274 // and only call must be in WebStateWeakPtrFactory. Please consult that class | 283 // and only call must be in WebStateWeakPtrFactory. Please consult that class |
| 275 // for more details. Remove as part of http://crbug.com/556736. | 284 // for more details. Remove as part of http://crbug.com/556736. |
| 276 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; | 285 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; |
| 277 }; | 286 }; |
| 278 | 287 |
| 279 } // namespace web | 288 } // namespace web |
| 280 | 289 |
| 281 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ | 290 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| OLD | NEW |