| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 explicit ScriptInjectionManager( | 37 explicit ScriptInjectionManager( |
| 38 UserScriptSetManager* user_script_set_manager); | 38 UserScriptSetManager* user_script_set_manager); |
| 39 virtual ~ScriptInjectionManager(); | 39 virtual ~ScriptInjectionManager(); |
| 40 | 40 |
| 41 // Notifies that a new render view has been created. | 41 // Notifies that a new render view has been created. |
| 42 void OnRenderFrameCreated(content::RenderFrame* render_frame); | 42 void OnRenderFrameCreated(content::RenderFrame* render_frame); |
| 43 | 43 |
| 44 // Removes pending injections of the unloaded extension. | 44 // Removes pending injections of the unloaded extension. |
| 45 void OnExtensionUnloaded(const std::string& extension_id); | 45 void OnExtensionUnloaded(const std::string& extension_id); |
| 46 | 46 |
| 47 void set_activity_logging_enabled(bool enabled) { |
| 48 activity_logging_enabled_ = enabled; |
| 49 } |
| 50 |
| 47 private: | 51 private: |
| 48 // A RenderFrameObserver implementation which watches the various render | 52 // A RenderFrameObserver implementation which watches the various render |
| 49 // frames in order to notify the ScriptInjectionManager of different | 53 // frames in order to notify the ScriptInjectionManager of different |
| 50 // document load states and IPCs. | 54 // document load states and IPCs. |
| 51 class RFOHelper; | 55 class RFOHelper; |
| 52 | 56 |
| 53 using FrameStatusMap = | 57 using FrameStatusMap = |
| 54 std::map<content::RenderFrame*, UserScript::RunLocation>; | 58 std::map<content::RenderFrame*, UserScript::RunLocation>; |
| 55 | 59 |
| 56 using ScriptInjectionVector = std::vector<std::unique_ptr<ScriptInjection>>; | 60 using ScriptInjectionVector = std::vector<std::unique_ptr<ScriptInjection>>; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // The set of UserScripts associated with extensions. Owned by the Dispatcher. | 112 // The set of UserScripts associated with extensions. Owned by the Dispatcher. |
| 109 UserScriptSetManager* user_script_set_manager_; | 113 UserScriptSetManager* user_script_set_manager_; |
| 110 | 114 |
| 111 // Pending injections which are waiting for either the proper run location or | 115 // Pending injections which are waiting for either the proper run location or |
| 112 // user consent. | 116 // user consent. |
| 113 ScriptInjectionVector pending_injections_; | 117 ScriptInjectionVector pending_injections_; |
| 114 | 118 |
| 115 // Running injections which are waiting for async callbacks from blink. | 119 // Running injections which are waiting for async callbacks from blink. |
| 116 ScriptInjectionVector running_injections_; | 120 ScriptInjectionVector running_injections_; |
| 117 | 121 |
| 122 // Whether or not dom activity should be logged for scripts injected. |
| 123 bool activity_logging_enabled_; |
| 124 |
| 118 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> | 125 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> |
| 119 user_script_set_manager_observer_; | 126 user_script_set_manager_observer_; |
| 120 | 127 |
| 121 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); | 128 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); |
| 122 }; | 129 }; |
| 123 | 130 |
| 124 } // namespace extensions | 131 } // namespace extensions |
| 125 | 132 |
| 126 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ | 133 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ |
| OLD | NEW |