| 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_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
| 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "extensions/browser/extension_registry_observer.h" | 14 #include "extensions/browser/extension_registry_observer.h" |
| 14 #include "extensions/common/host_id.h" | 15 #include "extensions/common/host_id.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class BrowserContext; | 18 class BrowserContext; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 class DeclarativeUserScriptMaster; | 22 class DeclarativeUserScriptMaster; |
| 22 | 23 |
| 23 // Manages a set of DeclarativeUserScriptMaster objects for script injections. | 24 // Manages a set of DeclarativeUserScriptMaster objects for script injections. |
| 24 class DeclarativeUserScriptManager : public ExtensionRegistryObserver { | 25 class DeclarativeUserScriptManager : public KeyedService, |
| 26 public ExtensionRegistryObserver { |
| 25 public: | 27 public: |
| 26 explicit DeclarativeUserScriptManager( | 28 explicit DeclarativeUserScriptManager( |
| 27 content::BrowserContext* browser_context); | 29 content::BrowserContext* browser_context); |
| 28 ~DeclarativeUserScriptManager() override; | 30 ~DeclarativeUserScriptManager() override; |
| 29 | 31 |
| 30 // Gets the user script master for declarative scripts by the given | 32 // Gets the user script master for declarative scripts by the given |
| 31 // HostID; if one does not exist, a new object will be created. | 33 // HostID; if one does not exist, a new object will be created. |
| 32 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( | 34 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( |
| 33 const HostID& host_id); | 35 const HostID& host_id); |
| 34 | 36 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 | 55 |
| 54 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 56 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 55 extension_registry_observer_; | 57 extension_registry_observer_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); | 59 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 } // namespace extensions | 62 } // namespace extensions |
| 61 | 63 |
| 62 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ | 64 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
| OLD | NEW |