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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
10 #include "base/compiler_specific.h"
11 #include "extensions/browser/extension_system.h"
12 #include "extensions/common/one_shot_event.h"
14 class BrowserContextKeyedServiceFactory;
24 namespace extensions {
26 class DeclarativeUserScriptMaster;
29 class LazyBackgroundTaskQueue;
31 class RendererStartupHelper;
32 class SharedUserScriptMaster;
34 // A simplified version of ExtensionSystem for app_shell. Allows
35 // app_shell to skip initialization of services it doesn't need.
36 class ShellExtensionSystem : public ExtensionSystem {
38 explicit ShellExtensionSystem(content::BrowserContext* browser_context);
39 ~ShellExtensionSystem() override;
41 // Loads an unpacked application from a directory. Returns the extension on
42 // success, or null otherwise.
43 const Extension* LoadApp(const base::FilePath& app_dir);
45 // Initializes the extension system.
48 // Launch the app with id |extension_id|.
49 void LaunchApp(const std::string& extension_id);
51 // KeyedService implementation:
52 void Shutdown() override;
54 // ExtensionSystem implementation:
55 void InitForRegularProfile(bool extensions_enabled) override;
56 ExtensionService* extension_service() override;
57 RuntimeData* runtime_data() override;
58 ManagementPolicy* management_policy() override;
59 SharedUserScriptMaster* shared_user_script_master() override;
60 StateStore* state_store() override;
61 StateStore* rules_store() override;
62 InfoMap* info_map() override;
63 LazyBackgroundTaskQueue* lazy_background_task_queue() override;
64 EventRouter* event_router() override;
65 ErrorConsole* error_console() override;
66 InstallVerifier* install_verifier() override;
67 QuotaService* quota_service() override;
68 void RegisterExtensionWithRequestContexts(
69 const Extension* extension) override;
70 void UnregisterExtensionWithRequestContexts(
71 const std::string& extension_id,
72 const UnloadedExtensionInfo::Reason reason) override;
73 const OneShotEvent& ready() const override;
74 ContentVerifier* content_verifier() override;
75 scoped_ptr<ExtensionSet> GetDependentExtensions(
76 const Extension* extension) override;
77 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByExtension(
78 const ExtensionId& extension_id) override;
81 content::BrowserContext* browser_context_; // Not owned.
83 // Data to be accessed on the IO thread. Must outlive process_manager_.
84 scoped_refptr<InfoMap> info_map_;
86 scoped_ptr<RuntimeData> runtime_data_;
87 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_;
88 scoped_ptr<EventRouter> event_router_;
89 scoped_ptr<QuotaService> quota_service_;
91 // Signaled when the extension system has completed its startup tasks.
94 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem);
97 } // namespace extensions
99 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_