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

Side by Side Diff: ios/web_view/internal/web_view_early_page_script_provider.h

Issue 2764773002: Add CWVUserContentController which enables injecting JavaScripts. (Closed)
Patch Set: Rebase. Created 3 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2017 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_WEB_VIEW_INTERNAL_WEB_VIEW_EARLY_PAGE_SCRIPT_PROVIDER_H_
6 #define IOS_WEB_VIEW_INTERNAL_WEB_VIEW_EARLY_PAGE_SCRIPT_PROVIDER_H_
7
8 #include <Foundation/Foundation.h>
9
10 #include "base/mac/scoped_nsobject.h"
11 #include "base/macros.h"
12 #include "base/supports_user_data.h"
13
14 namespace web {
15 class BrowserState;
16 }
17
18 namespace ios_web_view {
19
20 // A provider class associated with a single web::BrowserState object. Keeps
21 // an early page script, a JavaScript injected into all pages as early as
22 // possible.
23 //
24 // Not threadsafe. Must be used only on the main thread.
25 class WebViewEarlyPageScriptProvider : public base::SupportsUserData::Data {
26 public:
27 ~WebViewEarlyPageScriptProvider() override;
28
29 // Returns a provider for the given |browser_state|. Lazily attaches one if it
30 // does not exist. |browser_state| can not be null.
31 static WebViewEarlyPageScriptProvider& FromBrowserState(
32 web::BrowserState* _Nonnull browser_state);
33
34 // Getter and Setter for the JavaScript source code.
35 NSString* _Nonnull GetScript() { return script_.get(); }
36 void SetScript(NSString* _Nonnull script);
37
38 private:
39 WebViewEarlyPageScriptProvider();
40
41 // The JavaScript source code.
42 base::scoped_nsobject<NSString> script_;
43
44 DISALLOW_COPY_AND_ASSIGN(WebViewEarlyPageScriptProvider);
45 };
46
47 } // namespace ios_web_view
48
49 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_EARLY_PAGE_SCRIPT_PROVIDER_H_
OLDNEW
« no previous file with comments | « ios/web_view/internal/cwv_web_view_configuration.mm ('k') | ios/web_view/internal/web_view_early_page_script_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698