Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / extensions / shell / browser / shell_extension_system.h
blob29d2982b11315efad078d15f92aa0cae3c92cdf0
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_
8 #include <vector>
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"
15 namespace base {
16 class FilePath;
19 namespace content {
20 class BrowserContext;
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 {
28 public:
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.
37 void Init();
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;
67 private:
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.
80 OneShotEvent ready_;
82 base::WeakPtrFactory<ShellExtensionSystem> weak_factory_;
84 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem);
87 } // namespace extensions
89 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_