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 "base/memory/weak_ptr.h"
12 #include "extensions/browser/extension_system.h"
13 #include "extensions/common/one_shot_event.h"
23 namespace extensions
{
25 // A simplified version of ExtensionSystem for app_shell. Allows
26 // app_shell to skip initialization of services it doesn't need.
27 class ShellExtensionSystem
: public ExtensionSystem
{
29 explicit ShellExtensionSystem(content::BrowserContext
* browser_context
);
30 ~ShellExtensionSystem() override
;
32 // Loads an unpacked application from a directory. Returns the extension on
33 // success, or null otherwise.
34 const Extension
* LoadApp(const base::FilePath
& app_dir
);
36 // Initializes the extension system.
39 // Launch the app with id |extension_id|.
40 void LaunchApp(const std::string
& extension_id
);
42 // KeyedService implementation:
43 void Shutdown() override
;
45 // ExtensionSystem implementation:
46 void InitForRegularProfile(bool extensions_enabled
) override
;
47 ExtensionService
* extension_service() override
;
48 RuntimeData
* runtime_data() override
;
49 ManagementPolicy
* management_policy() override
;
50 ServiceWorkerManager
* service_worker_manager() override
;
51 SharedUserScriptMaster
* shared_user_script_master() override
;
52 StateStore
* state_store() override
;
53 StateStore
* rules_store() override
;
54 InfoMap
* info_map() override
;
55 QuotaService
* quota_service() override
;
56 AppSorting
* app_sorting() override
;
57 void RegisterExtensionWithRequestContexts(
58 const Extension
* extension
,
59 const base::Closure
& callback
) override
;
60 void UnregisterExtensionWithRequestContexts(
61 const std::string
& extension_id
,
62 const UnloadedExtensionInfo::Reason reason
) override
;
63 const OneShotEvent
& ready() const override
;
64 ContentVerifier
* content_verifier() override
;
65 scoped_ptr
<ExtensionSet
> GetDependentExtensions(
66 const Extension
* extension
) override
;
69 void OnExtensionRegisteredWithRequestContexts(
70 scoped_refptr
<Extension
> extension
);
71 content::BrowserContext
* browser_context_
; // Not owned.
73 // Data to be accessed on the IO thread. Must outlive process_manager_.
74 scoped_refptr
<InfoMap
> info_map_
;
76 scoped_ptr
<ServiceWorkerManager
> service_worker_manager_
;
77 scoped_ptr
<RuntimeData
> runtime_data_
;
78 scoped_ptr
<QuotaService
> quota_service_
;
79 scoped_ptr
<AppSorting
> app_sorting_
;
81 // Signaled when the extension system has completed its startup tasks.
84 base::WeakPtrFactory
<ShellExtensionSystem
> weak_factory_
;
86 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem
);
89 } // namespace extensions
91 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_