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

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

Issue 2134613002: Stop injection when injections are invalidated Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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_MANAGER_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void set_activity_logging_enabled(bool enabled) { 47 void set_activity_logging_enabled(bool enabled) {
48 activity_logging_enabled_ = enabled; 48 activity_logging_enabled_ = enabled;
49 } 49 }
50 50
51 private: 51 private:
52 // A RenderFrameObserver implementation which watches the various render 52 // A RenderFrameObserver implementation which watches the various render
53 // frames in order to notify the ScriptInjectionManager of different 53 // frames in order to notify the ScriptInjectionManager of different
54 // document load states and IPCs. 54 // document load states and IPCs.
55 class RFOHelper; 55 class RFOHelper;
56 class ScriptInjectionWatcher;
56 57
57 using FrameStatusMap = 58 using FrameStatusMap =
58 std::map<content::RenderFrame*, UserScript::RunLocation>; 59 std::map<content::RenderFrame*, UserScript::RunLocation>;
59 60
60 using ScriptInjectionVector = std::vector<std::unique_ptr<ScriptInjection>>; 61 using ScriptInjectionVector = std::vector<std::unique_ptr<ScriptInjection>>;
61 62
62 // Notifies that an injection has been finished. 63 // Notifies that an injection has been finished.
63 void OnInjectionFinished(ScriptInjection* injection); 64 void OnInjectionFinished(ScriptInjection* injection);
64 65
65 // UserScriptSetManager::Observer implementation. 66 // UserScriptSetManager::Observer implementation.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // The set of UserScripts associated with extensions. Owned by the Dispatcher. 113 // The set of UserScripts associated with extensions. Owned by the Dispatcher.
113 UserScriptSetManager* user_script_set_manager_; 114 UserScriptSetManager* user_script_set_manager_;
114 115
115 // Pending injections which are waiting for either the proper run location or 116 // Pending injections which are waiting for either the proper run location or
116 // user consent. 117 // user consent.
117 ScriptInjectionVector pending_injections_; 118 ScriptInjectionVector pending_injections_;
118 119
119 // Running injections which are waiting for async callbacks from blink. 120 // Running injections which are waiting for async callbacks from blink.
120 ScriptInjectionVector running_injections_; 121 ScriptInjectionVector running_injections_;
121 122
123 // Tracks injections that are about to be injected. Injections are added
124 // right before injection, and removed immediately after.
125 std::vector<ScriptInjectionWatcher*> injection_watchers_;
126
122 // Whether or not dom activity should be logged for scripts injected. 127 // Whether or not dom activity should be logged for scripts injected.
123 bool activity_logging_enabled_ = false; 128 bool activity_logging_enabled_ = false;
124 129
125 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> 130 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer>
126 user_script_set_manager_observer_; 131 user_script_set_manager_observer_;
127 132
128 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); 133 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager);
129 }; 134 };
130 135
131 } // namespace extensions 136 } // namespace extensions
132 137
133 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ 138 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698