| 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_USER_SCRIPT_SET_MANAGER_H_ | 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
| 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 UserScriptSetManager(); | 53 UserScriptSetManager(); |
| 54 | 54 |
| 55 ~UserScriptSetManager() override; | 55 ~UserScriptSetManager() override; |
| 56 | 56 |
| 57 void AddObserver(Observer* observer); | 57 void AddObserver(Observer* observer); |
| 58 void RemoveObserver(Observer* observer); | 58 void RemoveObserver(Observer* observer); |
| 59 | 59 |
| 60 // Looks up the script injection associated with |script_id| and | 60 // Looks up the script injection associated with |script_id| and |
| 61 // |extension_id| in the context of the given |web_frame|, |tab_id|, | 61 // |extension_id| in the context of the given |web_frame|, |tab_id|, |
| 62 // and |url|. | 62 // and |url|. |
| 63 scoped_ptr<ScriptInjection> GetInjectionForDeclarativeScript( | 63 std::unique_ptr<ScriptInjection> GetInjectionForDeclarativeScript( |
| 64 int script_id, | 64 int script_id, |
| 65 content::RenderFrame* render_frame, | 65 content::RenderFrame* render_frame, |
| 66 int tab_id, | 66 int tab_id, |
| 67 const GURL& url, | 67 const GURL& url, |
| 68 const std::string& extension_id); | 68 const std::string& extension_id); |
| 69 | 69 |
| 70 // Append all injections from |static_scripts| and each of | 70 // Append all injections from |static_scripts| and each of |
| 71 // |programmatic_scripts_| to |injections|. | 71 // |programmatic_scripts_| to |injections|. |
| 72 void GetAllInjections(std::vector<scoped_ptr<ScriptInjection>>* injections, | 72 void GetAllInjections( |
| 73 content::RenderFrame* render_frame, | 73 std::vector<std::unique_ptr<ScriptInjection>>* injections, |
| 74 int tab_id, | 74 content::RenderFrame* render_frame, |
| 75 UserScript::RunLocation run_location); | 75 int tab_id, |
| 76 UserScript::RunLocation run_location); |
| 76 | 77 |
| 77 // Get active extension IDs from |static_scripts| and each of | 78 // Get active extension IDs from |static_scripts| and each of |
| 78 // |programmatic_scripts_|. | 79 // |programmatic_scripts_|. |
| 79 void GetAllActiveExtensionIds(std::set<std::string>* ids) const; | 80 void GetAllActiveExtensionIds(std::set<std::string>* ids) const; |
| 80 | 81 |
| 81 const UserScriptSet* static_scripts() const { return &static_scripts_; } | 82 const UserScriptSet* static_scripts() const { return &static_scripts_; } |
| 82 | 83 |
| 83 private: | 84 private: |
| 84 // Map for per-extension sets that may be defined programmatically. | 85 // Map for per-extension sets that may be defined programmatically. |
| 85 typedef std::map<HostID, linked_ptr<UserScriptSet> > UserScriptSetMap; | 86 typedef std::map<HostID, linked_ptr<UserScriptSet> > UserScriptSetMap; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 104 | 105 |
| 105 // The associated observers. | 106 // The associated observers. |
| 106 base::ObserverList<Observer> observers_; | 107 base::ObserverList<Observer> observers_; |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); | 109 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace extensions | 112 } // namespace extensions |
| 112 | 113 |
| 113 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 114 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
| OLD | NEW |