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

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: Revert changes in ExtensionSystems and update WebViewContentScriptManager. 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 #include "base/supports_user_data.h"
13
14 struct HostID;
15
16 namespace content {
17 class BrowserContext;
18 }
19
20 namespace extensions {
21 class UserScript;
22
23 // WebViewContentScriptManager manages the content scripts that each webview
24 // guest adds and removes programmatically.
25 class WebViewContentScriptManager : public base::SupportsUserData::Data {
26 public:
27 explicit WebViewContentScriptManager(
28 content::BrowserContext* browser_context);
29 ~WebViewContentScriptManager() override;
30
31 static WebViewContentScriptManager* Get(
32 content::BrowserContext* browser_context);
33
34 // Adds content scripts for the guest specified by the |embedder_process_id,
35 // guest_view_instance_id|.
36 // The name of each content sccript is its key in |user_scripts| map.
37 void AddContentScripts(int embedder_process_id,
38 int guest_view_instance_id,
39 const HostID& host_id,
40 const std::map<std::string, UserScript>& user_scripts);
41
42 // Removes contents scipts whose names are in the |script_name_list| for the
43 // guest specified by |embedder_process_id, guest_view_instance_id|.
44 // If the |script_name_list| is empty, removes all the content scripts added
45 // for this guest.
46 void RemoveContentScripts(int embedder_process_id,
47 int guest_view_instance_id,
48 const HostID& host_id,
49 std::vector<std::string>* script_name_list);
50
51 // Returns whether the content script with |script_id| belonges to the guest
52 // specified by |embedder_process_id, guest_view_instance_id|.
53 bool OwnsUserScript(int embedder_process_id,
54 int guest_view_instance_id,
55 int script_id);
56
57 private:
58 content::BrowserContext* browser_context_;
59 };
60
61 } // namespace extensions
62
63 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_CONTENT_SCRIPT_MANAGE R_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698