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

Side by Side Diff: extensions/renderer/user_script_set.h

Issue 2089333002: [Extensions] Add renderer-side logic to short circuit activity logging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Guard adding dom activity loggers Created 4 years, 6 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 | « extensions/renderer/scripts_run_info.cc ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Appends the ids of the extensions that have user scripts to |ids|. 47 // Appends the ids of the extensions that have user scripts to |ids|.
48 void GetActiveExtensionIds(std::set<std::string>* ids) const; 48 void GetActiveExtensionIds(std::set<std::string>* ids) const;
49 49
50 // Append any ScriptInjections that should run on the given |render_frame| and 50 // Append any ScriptInjections that should run on the given |render_frame| and
51 // |tab_id|, at the given |run_location|, to |injections|. 51 // |tab_id|, at the given |run_location|, to |injections|.
52 // |extensions| is passed in to verify the corresponding extension is still 52 // |extensions| is passed in to verify the corresponding extension is still
53 // valid. 53 // valid.
54 void GetInjections(std::vector<std::unique_ptr<ScriptInjection>>* injections, 54 void GetInjections(std::vector<std::unique_ptr<ScriptInjection>>* injections,
55 content::RenderFrame* render_frame, 55 content::RenderFrame* render_frame,
56 int tab_id, 56 int tab_id,
57 UserScript::RunLocation run_location); 57 UserScript::RunLocation run_location,
58 bool log_activity);
58 59
59 std::unique_ptr<ScriptInjection> GetDeclarativeScriptInjection( 60 std::unique_ptr<ScriptInjection> GetDeclarativeScriptInjection(
60 int script_id, 61 int script_id,
61 content::RenderFrame* render_frame, 62 content::RenderFrame* render_frame,
62 int tab_id, 63 int tab_id,
63 UserScript::RunLocation run_location, 64 UserScript::RunLocation run_location,
64 const GURL& document_url); 65 const GURL& document_url,
66 bool log_activity);
65 67
66 // Updates scripts given the shared memory region containing user scripts. 68 // Updates scripts given the shared memory region containing user scripts.
67 // Returns true if the scripts were successfully updated. 69 // Returns true if the scripts were successfully updated.
68 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory, 70 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory,
69 const std::set<HostID>& changed_hosts, 71 const std::set<HostID>& changed_hosts,
70 bool whitelisted_only); 72 bool whitelisted_only);
71 73
72 const std::vector<UserScript*>& scripts() const { return scripts_.get(); } 74 const std::vector<UserScript*>& scripts() const { return scripts_.get(); }
73 75
74 private: 76 private:
75 // Returns a new ScriptInjection for the given |script| to execute in the 77 // Returns a new ScriptInjection for the given |script| to execute in the
76 // |render_frame|, or NULL if the script should not execute. 78 // |render_frame|, or NULL if the script should not execute.
77 std::unique_ptr<ScriptInjection> GetInjectionForScript( 79 std::unique_ptr<ScriptInjection> GetInjectionForScript(
78 const UserScript* script, 80 const UserScript* script,
79 content::RenderFrame* render_frame, 81 content::RenderFrame* render_frame,
80 int tab_id, 82 int tab_id,
81 UserScript::RunLocation run_location, 83 UserScript::RunLocation run_location,
82 const GURL& document_url, 84 const GURL& document_url,
83 bool is_declarative); 85 bool is_declarative,
86 bool log_activity);
84 87
85 // Shared memory containing raw script data. 88 // Shared memory containing raw script data.
86 std::unique_ptr<base::SharedMemory> shared_memory_; 89 std::unique_ptr<base::SharedMemory> shared_memory_;
87 90
88 // The UserScripts this injector manages. 91 // The UserScripts this injector manages.
89 ScopedVector<UserScript> scripts_; 92 ScopedVector<UserScript> scripts_;
90 93
91 // The associated observers. 94 // The associated observers.
92 base::ObserverList<Observer> observers_; 95 base::ObserverList<Observer> observers_;
93 96
94 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); 97 DISALLOW_COPY_AND_ASSIGN(UserScriptSet);
95 }; 98 };
96 99
97 } // namespace extensions 100 } // namespace extensions
98 101
99 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ 102 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
OLDNEW
« no previous file with comments | « extensions/renderer/scripts_run_info.cc ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698