Chromium Code Reviews| Index: ios/public/provider/web/web_controller_provider.h |
| diff --git a/ios/public/provider/web/web_controller_provider.h b/ios/public/provider/web/web_controller_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..93c747f1dadd945665abd8683b1a642af09de23e |
| --- /dev/null |
| +++ b/ios/public/provider/web/web_controller_provider.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ |
| +#define IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ios/web/public/web_state/web_state_observer.h" |
|
droger
2015/02/19 10:51:04
Does this pass DEPS checks? If not, where is the D
sdefresne
2015/02/19 13:39:08
I'll cleanup DEPS in another CL. It looks like eve
|
| +#include "ios/web/web_state/ui/web_view_js_utils.h" |
|
droger
2015/02/19 10:51:03
This include seems needed because of web::JavaScri
sdefresne
2015/02/19 13:39:08
Done.
|
| + |
| +class GURL; |
| + |
| +namespace web { |
| +class BrowserState; |
| +class WebState; |
| +} |
| + |
| +namespace ios { |
| + |
| +class WebControllerProviderFactory; |
| + |
| +// Setter and getter for the provider factory. The provider factory should be |
| +// set early, before any component using WebControllerProviders is called. |
| +void SetWebControllerProviderFactory( |
| + WebControllerProviderFactory* provider_factory); |
| +WebControllerProviderFactory* GetWebControllerProviderFactory(); |
| + |
| +// Interface that provides URL-loading and JavaScript injection with optional |
| +// dialog suppression. |
| +class WebControllerProvider { |
| + public: |
| + // Constructor for a WebControllerProvider backed by a CRWWebController |
| + // initialized with |browser_state|. |
| + WebControllerProvider(web::BrowserState* browser_state); |
|
droger
2015/02/19 10:51:03
explicit
sdefresne
2015/02/19 13:39:08
Done.
|
| + virtual ~WebControllerProvider(); |
| + |
| + // Determines whether JavaScript dialogs are allowed. |
| + virtual bool SuppressesDialogs() const; |
| + virtual void SetSuppressesDialogs(bool should_suppress_dialogs) {} |
| + |
| + // Triggers a load of |url|. |
| + virtual void LoadURL(const GURL& url) {} |
| + |
| + // Retyrns the WebState associated with this web controller. |
|
droger
2015/02/19 10:51:03
s/Retyrns/Returns/
sdefresne
2015/02/19 13:39:08
Done.
|
| + virtual web::WebState* GetWebState() const; |
| + |
| + // Injects |script| into the previously loaded page, if any, and calls |
| + // |completion| with the result. Calls |completion| with nil parameters |
| + // when there is no previously loaded page. |
| + virtual void InjectScript(const std::string& script, |
| + web::JavaScriptCompletion completion); |
| +}; |
| + |
| +class WebControllerProviderFactory { |
| + public: |
| + WebControllerProviderFactory(); |
| + virtual ~WebControllerProviderFactory(); |
| + |
| + // Vends WebControllerProviders created using |browser_state|, passing |
| + // ownership to callers. |
| + virtual scoped_ptr<WebControllerProvider> CreateWebControllerProvider( |
| + web::BrowserState* browser_state); |
| +}; |
| + |
| +} // namespace ios |
| + |
| +#endif // IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ |