| 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> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class NavigationManager; | 41 class NavigationManager; |
| 42 class WebInterstitial; | 42 class WebInterstitial; |
| 43 class WebStateDelegate; | 43 class WebStateDelegate; |
| 44 class WebStateObserver; | 44 class WebStateObserver; |
| 45 class WebStatePolicyDecider; | 45 class WebStatePolicyDecider; |
| 46 class WebStateWeakPtrFactory; | 46 class WebStateWeakPtrFactory; |
| 47 | 47 |
| 48 // Core interface for interaction with the web. | 48 // Core interface for interaction with the web. |
| 49 class WebState : public base::SupportsUserData { | 49 class WebState : public base::SupportsUserData { |
| 50 public: | 50 public: |
| 51 // Parameters for the Create() method. |
| 52 struct CreateParams { |
| 53 explicit CreateParams(web::BrowserState* browser_state); |
| 54 ~CreateParams(); |
| 55 |
| 56 web::BrowserState* browser_state; |
| 57 }; |
| 58 |
| 51 // Parameters for the OpenURL() method. | 59 // Parameters for the OpenURL() method. |
| 52 struct OpenURLParams { | 60 struct OpenURLParams { |
| 53 OpenURLParams(const GURL& url, | 61 OpenURLParams(const GURL& url, |
| 54 const Referrer& referrer, | 62 const Referrer& referrer, |
| 55 WindowOpenDisposition disposition, | 63 WindowOpenDisposition disposition, |
| 56 ui::PageTransition transition, | 64 ui::PageTransition transition, |
| 57 bool is_renderer_initiated); | 65 bool is_renderer_initiated); |
| 58 ~OpenURLParams(); | 66 ~OpenURLParams(); |
| 59 | 67 |
| 60 // The URL/referrer to be opened. | 68 // The URL/referrer to be opened. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 int, /* HTTP status code */ | 85 int, /* HTTP status code */ |
| 78 const GURL&, /* image_url */ | 86 const GURL&, /* image_url */ |
| 79 const std::vector<SkBitmap>&, /* bitmaps */ | 87 const std::vector<SkBitmap>&, /* bitmaps */ |
| 80 /* The sizes in pixel of the bitmaps before they were resized due to the | 88 /* The sizes in pixel of the bitmaps before they were resized due to the |
| 81 max bitmap size passed to DownloadImage(). Each entry in the bitmaps | 89 max bitmap size passed to DownloadImage(). Each entry in the bitmaps |
| 82 vector corresponds to an entry in the sizes vector. If a bitmap was | 90 vector corresponds to an entry in the sizes vector. If a bitmap was |
| 83 resized, there should be a single returned bitmap. */ | 91 resized, there should be a single returned bitmap. */ |
| 84 const std::vector<gfx::Size>&)> | 92 const std::vector<gfx::Size>&)> |
| 85 ImageDownloadCallback; | 93 ImageDownloadCallback; |
| 86 | 94 |
| 95 // Creates a new WebState. |
| 96 static std::unique_ptr<WebState> Create(const CreateParams& params); |
| 97 |
| 87 ~WebState() override {} | 98 ~WebState() override {} |
| 88 | 99 |
| 89 // Gets/Sets the delegate. | 100 // Gets/Sets the delegate. |
| 90 virtual WebStateDelegate* GetDelegate() = 0; | 101 virtual WebStateDelegate* GetDelegate() = 0; |
| 91 virtual void SetDelegate(WebStateDelegate* delegate) = 0; | 102 virtual void SetDelegate(WebStateDelegate* delegate) = 0; |
| 92 | 103 |
| 93 // Whether or not a web view is allowed to exist in this WebState. Defaults | 104 // Whether or not a web view is allowed to exist in this WebState. Defaults |
| 94 // to false; this should be enabled before attempting to access the view. | 105 // to false; this should be enabled before attempting to access the view. |
| 95 virtual bool IsWebUsageEnabled() const = 0; | 106 virtual bool IsWebUsageEnabled() const = 0; |
| 96 virtual void SetWebUsageEnabled(bool enabled) = 0; | 107 virtual void SetWebUsageEnabled(bool enabled) = 0; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 251 |
| 241 // Returns a WeakPtr<WebState> to the current WebState. Must remain private | 252 // Returns a WeakPtr<WebState> to the current WebState. Must remain private |
| 242 // and only call must be in WebStateWeakPtrFactory. Please consult that class | 253 // and only call must be in WebStateWeakPtrFactory. Please consult that class |
| 243 // for more details. Remove as part of http://crbug.com/556736. | 254 // for more details. Remove as part of http://crbug.com/556736. |
| 244 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; | 255 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; |
| 245 }; | 256 }; |
| 246 | 257 |
| 247 } // namespace web | 258 } // namespace web |
| 248 | 259 |
| 249 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ | 260 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| OLD | NEW |