Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: ios/public/provider/web/web_controller_provider.h

Issue 914993006: Upstream web_controller_provider and dependencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@libusb
Patch Set: Remove weak dependency on WebKit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/public/provider/web/OWNERS ('k') | ios/public/provider/web/web_controller_provider.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/block_types.h"
10 #include "ios/web/public/web_state/web_state_observer.h"
11 #include "url/gurl.h"
12
13 namespace web {
14 class BrowserState;
15 class WebState;
16 }
17
18 namespace ios {
19
20 class WebControllerProviderFactory;
21
22 // Setter and getter for the provider factory. The provider factory should be
23 // set early, before any component using WebControllerProviders is called.
24 void SetWebControllerProviderFactory(
25 WebControllerProviderFactory* provider_factory);
26 WebControllerProviderFactory* GetWebControllerProviderFactory();
27
28 // Interface that provides URL-loading and JavaScript injection with optional
29 // dialog suppression.
30 class WebControllerProvider {
31 public:
32 // Constructor for a WebControllerProvider backed by a CRWWebController
33 // initialized with |browser_state|.
34 explicit WebControllerProvider(web::BrowserState* browser_state);
35 virtual ~WebControllerProvider();
36
37 // Determines whether JavaScript dialogs are allowed.
38 virtual bool SuppressesDialogs() const;
39 virtual void SetSuppressesDialogs(bool should_suppress_dialogs) {}
40
41 // Triggers a load of |url|.
42 virtual void LoadURL(const GURL& url) {}
43
44 // Returns the WebState associated with this web controller.
45 virtual web::WebState* GetWebState() const;
46
47 // Injects |script| into the previously loaded page, if any, and calls
48 // |completion| with the result. Calls |completion| with nil parameters
49 // when there is no previously loaded page.
50 virtual void InjectScript(const std::string& script,
51 web::JavaScriptCompletion completion);
52 };
53
54 class WebControllerProviderFactory {
55 public:
56 WebControllerProviderFactory();
57 virtual ~WebControllerProviderFactory();
58
59 // Vends WebControllerProviders created using |browser_state|, passing
60 // ownership to callers.
61 virtual scoped_ptr<WebControllerProvider> CreateWebControllerProvider(
62 web::BrowserState* browser_state);
63 };
64
65 } // namespace ios
66
67 #endif // IOS_PUBLIC_PROVIDER_WEB_WEB_CONTROLLER_PROVIDER_H_
OLDNEW
« no previous file with comments | « ios/public/provider/web/OWNERS ('k') | ios/public/provider/web/web_controller_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698