| 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_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
| 13 #include "extensions/common/one_shot_event.h" | 13 #include "extensions/common/one_shot_event.h" |
| 14 | 14 |
| 15 class BrowserContextKeyedServiceFactory; | |
| 16 | |
| 17 namespace base { | 15 namespace base { |
| 18 class FilePath; | 16 class FilePath; |
| 19 } | 17 } |
| 20 | 18 |
| 21 namespace content { | 19 namespace content { |
| 22 class BrowserContext; | 20 class BrowserContext; |
| 23 } | 21 } |
| 24 | 22 |
| 25 namespace extensions { | 23 namespace extensions { |
| 26 | 24 |
| 27 class InfoMap; | |
| 28 class ProcessManager; | |
| 29 class RendererStartupHelper; | |
| 30 class SharedUserScriptMaster; | |
| 31 | |
| 32 // A simplified version of ExtensionSystem for app_shell. Allows | 25 // A simplified version of ExtensionSystem for app_shell. Allows |
| 33 // app_shell to skip initialization of services it doesn't need. | 26 // app_shell to skip initialization of services it doesn't need. |
| 34 class ShellExtensionSystem : public ExtensionSystem { | 27 class ShellExtensionSystem : public ExtensionSystem { |
| 35 public: | 28 public: |
| 36 explicit ShellExtensionSystem(content::BrowserContext* browser_context); | 29 explicit ShellExtensionSystem(content::BrowserContext* browser_context); |
| 37 ~ShellExtensionSystem() override; | 30 ~ShellExtensionSystem() override; |
| 38 | 31 |
| 39 // Loads an unpacked application from a directory. Returns the extension on | 32 // Loads an unpacked application from a directory. Returns the extension on |
| 40 // success, or null otherwise. | 33 // success, or null otherwise. |
| 41 const Extension* LoadApp(const base::FilePath& app_dir); | 34 const Extension* LoadApp(const base::FilePath& app_dir); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 // ExtensionSystem implementation: | 45 // ExtensionSystem implementation: |
| 53 void InitForRegularProfile(bool extensions_enabled) override; | 46 void InitForRegularProfile(bool extensions_enabled) override; |
| 54 ExtensionService* extension_service() override; | 47 ExtensionService* extension_service() override; |
| 55 RuntimeData* runtime_data() override; | 48 RuntimeData* runtime_data() override; |
| 56 ManagementPolicy* management_policy() override; | 49 ManagementPolicy* management_policy() override; |
| 57 SharedUserScriptMaster* shared_user_script_master() override; | 50 SharedUserScriptMaster* shared_user_script_master() override; |
| 58 StateStore* state_store() override; | 51 StateStore* state_store() override; |
| 59 StateStore* rules_store() override; | 52 StateStore* rules_store() override; |
| 60 InfoMap* info_map() override; | 53 InfoMap* info_map() override; |
| 61 QuotaService* quota_service() override; | 54 QuotaService* quota_service() override; |
| 55 AppSorting* app_sorting() override; |
| 62 void RegisterExtensionWithRequestContexts( | 56 void RegisterExtensionWithRequestContexts( |
| 63 const Extension* extension, | 57 const Extension* extension, |
| 64 const base::Closure& callback) override; | 58 const base::Closure& callback) override; |
| 65 void UnregisterExtensionWithRequestContexts( | 59 void UnregisterExtensionWithRequestContexts( |
| 66 const std::string& extension_id, | 60 const std::string& extension_id, |
| 67 const UnloadedExtensionInfo::Reason reason) override; | 61 const UnloadedExtensionInfo::Reason reason) override; |
| 68 const OneShotEvent& ready() const override; | 62 const OneShotEvent& ready() const override; |
| 69 ContentVerifier* content_verifier() override; | 63 ContentVerifier* content_verifier() override; |
| 70 scoped_ptr<ExtensionSet> GetDependentExtensions( | 64 scoped_ptr<ExtensionSet> GetDependentExtensions( |
| 71 const Extension* extension) override; | 65 const Extension* extension) override; |
| 72 | 66 |
| 73 private: | 67 private: |
| 74 void OnExtensionRegisteredWithRequestContexts( | 68 void OnExtensionRegisteredWithRequestContexts( |
| 75 scoped_refptr<Extension> extension); | 69 scoped_refptr<Extension> extension); |
| 76 content::BrowserContext* browser_context_; // Not owned. | 70 content::BrowserContext* browser_context_; // Not owned. |
| 77 | 71 |
| 78 // Data to be accessed on the IO thread. Must outlive process_manager_. | 72 // Data to be accessed on the IO thread. Must outlive process_manager_. |
| 79 scoped_refptr<InfoMap> info_map_; | 73 scoped_refptr<InfoMap> info_map_; |
| 80 | 74 |
| 81 scoped_ptr<RuntimeData> runtime_data_; | 75 scoped_ptr<RuntimeData> runtime_data_; |
| 82 scoped_ptr<QuotaService> quota_service_; | 76 scoped_ptr<QuotaService> quota_service_; |
| 77 scoped_ptr<AppSorting> app_sorting_; |
| 83 | 78 |
| 84 // Signaled when the extension system has completed its startup tasks. | 79 // Signaled when the extension system has completed its startup tasks. |
| 85 OneShotEvent ready_; | 80 OneShotEvent ready_; |
| 86 | 81 |
| 87 base::WeakPtrFactory<ShellExtensionSystem> weak_factory_; | 82 base::WeakPtrFactory<ShellExtensionSystem> weak_factory_; |
| 88 | 83 |
| 89 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem); | 84 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem); |
| 90 }; | 85 }; |
| 91 | 86 |
| 92 } // namespace extensions | 87 } // namespace extensions |
| 93 | 88 |
| 94 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 89 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| OLD | NEW |