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