| 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 20 matching lines...) Expand all Loading... |
| 31 // The ScriptInjectionManager manages extensions injecting scripts into frames | 31 // The ScriptInjectionManager manages extensions injecting scripts into frames |
| 32 // via both content/user scripts and tabs.executeScript(). It is responsible for | 32 // via both content/user scripts and tabs.executeScript(). It is responsible for |
| 33 // maintaining any pending injections awaiting permission or the appropriate | 33 // maintaining any pending injections awaiting permission or the appropriate |
| 34 // load point, and injecting them when ready. | 34 // load point, and injecting them when ready. |
| 35 class ScriptInjectionManager : public UserScriptSetManager::Observer { | 35 class ScriptInjectionManager : public UserScriptSetManager::Observer { |
| 36 public: | 36 public: |
| 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 // Called by Dispatcher when the document element has been inserted. |
| 42 void AfterDidCreateDocumentElement(content::RenderFrame* render_frame); |
| 43 |
| 44 // Called by Dispatcher when the document DOM is ready. |
| 45 void AfterDidFinishDocumentLoad(content::RenderFrame* render_frame); |
| 46 |
| 41 // Notifies that a new render view has been created. | 47 // Notifies that a new render view has been created. |
| 42 void OnRenderFrameCreated(content::RenderFrame* render_frame); | 48 void OnRenderFrameCreated(content::RenderFrame* render_frame); |
| 43 | 49 |
| 44 // Removes pending injections of the unloaded extension. | 50 // Removes pending injections of the unloaded extension. |
| 45 void OnExtensionUnloaded(const std::string& extension_id); | 51 void OnExtensionUnloaded(const std::string& extension_id); |
| 46 | 52 |
| 47 private: | 53 private: |
| 48 // A RenderFrameObserver implementation which watches the various render | 54 // A RenderFrameObserver implementation which watches the various render |
| 49 // frames in order to notify the ScriptInjectionManager of different | 55 // frames in order to notify the ScriptInjectionManager of different |
| 50 // document load states and IPCs. | 56 // document load states and IPCs. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 123 |
| 118 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> | 124 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> |
| 119 user_script_set_manager_observer_; | 125 user_script_set_manager_observer_; |
| 120 | 126 |
| 121 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); | 127 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 } // namespace extensions | 130 } // namespace extensions |
| 125 | 131 |
| 126 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ | 132 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ |
| OLD | NEW |