OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ | |
6 #define IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #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
| |
10 #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.
| |
11 | |
12 class GURL; | |
13 | |
14 namespace web { | |
15 class BrowserState; | |
16 class WebState; | |
17 } | |
18 | |
19 namespace ios { | |
20 | |
21 class WebControllerProviderFactory; | |
22 | |
23 // Setter and getter for the provider factory. The provider factory should be | |
24 // set early, before any component using WebControllerProviders is called. | |
25 void SetWebControllerProviderFactory( | |
26 WebControllerProviderFactory* provider_factory); | |
27 WebControllerProviderFactory* GetWebControllerProviderFactory(); | |
28 | |
29 // Interface that provides URL-loading and JavaScript injection with optional | |
30 // dialog suppression. | |
31 class WebControllerProvider { | |
32 public: | |
33 // Constructor for a WebControllerProvider backed by a CRWWebController | |
34 // initialized with |browser_state|. | |
35 WebControllerProvider(web::BrowserState* browser_state); | |
droger
2015/02/19 10:51:03
explicit
sdefresne
2015/02/19 13:39:08
Done.
| |
36 virtual ~WebControllerProvider(); | |
37 | |
38 // Determines whether JavaScript dialogs are allowed. | |
39 virtual bool SuppressesDialogs() const; | |
40 virtual void SetSuppressesDialogs(bool should_suppress_dialogs) {} | |
41 | |
42 // Triggers a load of |url|. | |
43 virtual void LoadURL(const GURL& url) {} | |
44 | |
45 // 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.
| |
46 virtual web::WebState* GetWebState() const; | |
47 | |
48 // Injects |script| into the previously loaded page, if any, and calls | |
49 // |completion| with the result. Calls |completion| with nil parameters | |
50 // when there is no previously loaded page. | |
51 virtual void InjectScript(const std::string& script, | |
52 web::JavaScriptCompletion completion); | |
53 }; | |
54 | |
55 class WebControllerProviderFactory { | |
56 public: | |
57 WebControllerProviderFactory(); | |
58 virtual ~WebControllerProviderFactory(); | |
59 | |
60 // Vends WebControllerProviders created using |browser_state|, passing | |
61 // ownership to callers. | |
62 virtual scoped_ptr<WebControllerProvider> CreateWebControllerProvider( | |
63 web::BrowserState* browser_state); | |
64 }; | |
65 | |
66 } // namespace ios | |
67 | |
68 #endif // IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_ | |
OLD | NEW |