| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 class WebStateWeakPtrFactory; | 50 class WebStateWeakPtrFactory; |
| 51 | 51 |
| 52 // Core interface for interaction with the web. | 52 // Core interface for interaction with the web. |
| 53 class WebState : public base::SupportsUserData { | 53 class WebState : public base::SupportsUserData { |
| 54 public: | 54 public: |
| 55 // Parameters for the Create() method. | 55 // Parameters for the Create() method. |
| 56 struct CreateParams { | 56 struct CreateParams { |
| 57 explicit CreateParams(web::BrowserState* browser_state); | 57 explicit CreateParams(web::BrowserState* browser_state); |
| 58 ~CreateParams(); | 58 ~CreateParams(); |
| 59 | 59 |
| 60 // The corresponding BrowserState for the new WebState. |
| 60 web::BrowserState* browser_state; | 61 web::BrowserState* browser_state; |
| 62 |
| 63 // Whether the WebState is created as the result of a window.open or by |
| 64 // clicking a link with a blank targer. Used to determin whether the |
| 65 // WebState is allowed to be closed via window.close(). |
| 66 bool created_with_opener; |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 // Parameters for the OpenURL() method. | 69 // Parameters for the OpenURL() method. |
| 64 struct OpenURLParams { | 70 struct OpenURLParams { |
| 65 OpenURLParams(const GURL& url, | 71 OpenURLParams(const GURL& url, |
| 66 const Referrer& referrer, | 72 const Referrer& referrer, |
| 67 WindowOpenDisposition disposition, | 73 WindowOpenDisposition disposition, |
| 68 ui::PageTransition transition, | 74 ui::PageTransition transition, |
| 69 bool is_renderer_initiated); | 75 bool is_renderer_initiated); |
| 70 ~OpenURLParams(); | 76 ~OpenURLParams(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // Removes the callback associated with |command_prefix|. | 230 // Removes the callback associated with |command_prefix|. |
| 225 virtual void RemoveScriptCommandCallback( | 231 virtual void RemoveScriptCommandCallback( |
| 226 const std::string& command_prefix) = 0; | 232 const std::string& command_prefix) = 0; |
| 227 | 233 |
| 228 // Returns the current CRWWebViewProxy object. | 234 // Returns the current CRWWebViewProxy object. |
| 229 virtual CRWWebViewProxyType GetWebViewProxy() const = 0; | 235 virtual CRWWebViewProxyType GetWebViewProxy() const = 0; |
| 230 | 236 |
| 231 // Returns Mojo interface registry for this WebState. | 237 // Returns Mojo interface registry for this WebState. |
| 232 virtual service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() = 0; | 238 virtual service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() = 0; |
| 233 | 239 |
| 240 // Returns whether this WebState was created with an opener. See |
| 241 // CreateParams::created_with_opener for more details. |
| 242 virtual bool HasOpener() const = 0; |
| 243 |
| 234 protected: | 244 protected: |
| 235 friend class WebStateObserver; | 245 friend class WebStateObserver; |
| 236 friend class WebStatePolicyDecider; | 246 friend class WebStatePolicyDecider; |
| 237 | 247 |
| 238 // Adds and removes observers for page navigation notifications. The order in | 248 // Adds and removes observers for page navigation notifications. The order in |
| 239 // which notifications are sent to observers is undefined. Clients must be | 249 // which notifications are sent to observers is undefined. Clients must be |
| 240 // sure to remove the observer before they go away. | 250 // sure to remove the observer before they go away. |
| 241 // TODO(droger): Move these methods to WebStateImpl once it is in ios/. | 251 // TODO(droger): Move these methods to WebStateImpl once it is in ios/. |
| 242 virtual void AddObserver(WebStateObserver* observer) = 0; | 252 virtual void AddObserver(WebStateObserver* observer) = 0; |
| 243 virtual void RemoveObserver(WebStateObserver* observer) = 0; | 253 virtual void RemoveObserver(WebStateObserver* observer) = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 256 | 266 |
| 257 // Returns a WeakPtr<WebState> to the current WebState. Must remain private | 267 // Returns a WeakPtr<WebState> to the current WebState. Must remain private |
| 258 // and only call must be in WebStateWeakPtrFactory. Please consult that class | 268 // and only call must be in WebStateWeakPtrFactory. Please consult that class |
| 259 // for more details. Remove as part of http://crbug.com/556736. | 269 // for more details. Remove as part of http://crbug.com/556736. |
| 260 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; | 270 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; |
| 261 }; | 271 }; |
| 262 | 272 |
| 263 } // namespace web | 273 } // namespace web |
| 264 | 274 |
| 265 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ | 275 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ |
| OLD | NEW |