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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_content_script_manager.h

Issue 959413003: Implement <webview>.addContentScript/removeContentScript API [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make the API work before the first navigation of guest. Created 5 years, 8 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 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_CONTENT_SCRIPT_MANAGER_H
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_CONTENT_SCRIPT_MANAGER_H
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 struct HostID;
13
14 namespace content {
15 class BrowserContext;
16 }
17
18 namespace extensions {
19 class UserScript;
20
21 // WebViewContentScriptManager manages the content scripts that each webview
22 // guest adds and removes programmatically.
23 class WebViewContentScriptManager {
24 public:
25 explicit WebViewContentScriptManager(
26 content::BrowserContext* browser_context);
27 ~WebViewContentScriptManager();
28
29 static WebViewContentScriptManager* Get(
30 content::BrowserContext* browser_context);
31
32 // Adds content scripts for the guest specified by the |embedder_process_id,
33 // guest_view_instance_id|.
34 // The name of each content sccript is its key in |user_scripts| map.
35 void AddContentScripts(int embedder_process_id,
36 int guest_view_instance_id,
37 const HostID& host_id,
38 const std::map<std::string, UserScript>& user_scripts);
39
40 // Removes contents scipts whose names are in the |script_name_list| for the
41 // guest specified by |embedder_process_id, guest_view_instance_id|.
42 // If the |script_name_list| is empty, removes all the content scripts added
43 // for this guest.
44 void RemoveContentScripts(int embedder_process_id,
45 int guest_view_instance_id,
46 std::vector<std::string>* script_name_list);
47
48 // Returns whether the content script with |script_id| belonges to the guest
49 // specified by |embedder_process_id, guest_view_instance_id|.
50 bool OwnsUserScript(int embedder_process_id,
51 int guest_view_instance_id,
52 int script_id);
53
54 private:
55 content::BrowserContext* browser_context_;
56 };
57
58 } // namespace extensions
59
60 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_CONTENT_SCRIPT_MANAGE R_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698