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 SharedUserScriptMaster
* shared_user_script_master() override
;
51 StateStore
* state_store() override
;
52 StateStore
* rules_store() override
;
53 InfoMap
* info_map() override
;
54 QuotaService
* quota_service() override
;
55 AppSorting
* app_sorting() override
;
56 void RegisterExtensionWithRequestContexts(
57 const Extension
* extension
,
58 const base::Closure
& callback
) override
;
59 void UnregisterExtensionWithRequestContexts(
60 const std::string
& extension_id
,
61 const UnloadedExtensionInfo::Reason reason
) override
;
62 const OneShotEvent
& ready() const override
;
63 ContentVerifier
* content_verifier() override
;
64 scoped_ptr
<ExtensionSet
> GetDependentExtensions(
65 const Extension
* extension
) override
;
68 void OnExtensionRegisteredWithRequestContexts(
69 scoped_refptr
<Extension
> extension
);
70 content::BrowserContext
* browser_context_
; // Not owned.
72 // Data to be accessed on the IO thread. Must outlive process_manager_.
73 scoped_refptr
<InfoMap
> info_map_
;
75 scoped_ptr
<RuntimeData
> runtime_data_
;
76 scoped_ptr
<QuotaService
> quota_service_
;
77 scoped_ptr
<AppSorting
> app_sorting_
;
79 // Signaled when the extension system has completed its startup tasks.
82 base::WeakPtrFactory
<ShellExtensionSystem
> weak_factory_
;
84 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem
);
87 } // namespace extensions
89 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_