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

Side by Side Diff: extensions/renderer/script_injection.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/dispatcher.cc ('k') | extensions/renderer/script_injection.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_SCRIPT_INJECTION_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Return the id of the injection host associated with the given world. 49 // Return the id of the injection host associated with the given world.
50 static std::string GetHostIdForIsolatedWorld(int world_id); 50 static std::string GetHostIdForIsolatedWorld(int world_id);
51 51
52 // Remove the isolated world associated with the given injection host. 52 // Remove the isolated world associated with the given injection host.
53 static void RemoveIsolatedWorld(const std::string& host_id); 53 static void RemoveIsolatedWorld(const std::string& host_id);
54 54
55 ScriptInjection(std::unique_ptr<ScriptInjector> injector, 55 ScriptInjection(std::unique_ptr<ScriptInjector> injector,
56 content::RenderFrame* render_frame, 56 content::RenderFrame* render_frame,
57 std::unique_ptr<const InjectionHost> injection_host, 57 std::unique_ptr<const InjectionHost> injection_host,
58 UserScript::RunLocation run_location); 58 UserScript::RunLocation run_location,
59 bool log_activity);
59 ~ScriptInjection(); 60 ~ScriptInjection();
60 61
61 // Try to inject the script at the |current_location|. This returns 62 // Try to inject the script at the |current_location|. This returns
62 // INJECTION_FINISHED if injection has injected or will never inject, returns 63 // INJECTION_FINISHED if injection has injected or will never inject, returns
63 // INJECTION_BLOCKED if injection is running asynchronously and has not 64 // INJECTION_BLOCKED if injection is running asynchronously and has not
64 // finished yet, returns INJECTION_WAITING if injections is delayed (either 65 // finished yet, returns INJECTION_WAITING if injections is delayed (either
65 // for permission purposes or because |current_location| is not the designated 66 // for permission purposes or because |current_location| is not the designated
66 // |run_location_|). 67 // |run_location_|).
67 // If INJECTION_BLOCKED is returned, |async_completion_callback| will be 68 // If INJECTION_BLOCKED is returned, |async_completion_callback| will be
68 // called upon completion. 69 // called upon completion.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // currently waiting on permission. 126 // currently waiting on permission.
126 int64_t request_id_; 127 int64_t request_id_;
127 128
128 // Whether or not the injection is complete, either via injecting the script 129 // Whether or not the injection is complete, either via injecting the script
129 // or because it will never complete. 130 // or because it will never complete.
130 bool complete_; 131 bool complete_;
131 132
132 // Whether or not the injection successfully injected JS. 133 // Whether or not the injection successfully injected JS.
133 bool did_inject_js_; 134 bool did_inject_js_;
134 135
136 // Whether or not we should log dom activity for this injection.
137 bool log_activity_;
138
135 // Results storage. 139 // Results storage.
136 std::unique_ptr<base::Value> execution_result_; 140 std::unique_ptr<base::Value> execution_result_;
137 141
138 // The callback to run upon completing asynchronously. 142 // The callback to run upon completing asynchronously.
139 CompletionCallback async_completion_callback_; 143 CompletionCallback async_completion_callback_;
140 144
141 // A helper class to hold the render frame and watch for its deletion. 145 // A helper class to hold the render frame and watch for its deletion.
142 std::unique_ptr<FrameWatcher> frame_watcher_; 146 std::unique_ptr<FrameWatcher> frame_watcher_;
143 147
144 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; 148 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_;
145 149
146 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); 150 DISALLOW_COPY_AND_ASSIGN(ScriptInjection);
147 }; 151 };
148 152
149 } // namespace extensions 153 } // namespace extensions
150 154
151 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 155 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/script_injection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698