Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / shell / browser / shell_extension_system.h
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.
4
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
7
8 #include <vector>
9
10 #include "base/compiler_specific.h"
11 #include "extensions/browser/extension_system.h"
12 #include "extensions/common/one_shot_event.h"
13
14 class BrowserContextKeyedServiceFactory;
15
16 namespace base {
17 class FilePath;
18 }
19
20 namespace content {
21 class BrowserContext;
22 }
23
24 namespace extensions {
25
26 class DeclarativeUserScriptMaster;
27 class EventRouter;
28 class InfoMap;
29 class LazyBackgroundTaskQueue;
30 class ProcessManager;
31 class RendererStartupHelper;
32 class SharedUserScriptMaster;
33
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 {
37  public:
38   explicit ShellExtensionSystem(content::BrowserContext* browser_context);
39   virtual ~ShellExtensionSystem();
40
41   // Loads an unpacked application from a directory. Returns true on success.
42   bool LoadApp(const base::FilePath& app_dir);
43
44   // Launch the currently loaded app.
45   void LaunchApp();
46
47   // KeyedService implementation:
48   virtual void Shutdown() OVERRIDE;
49
50   scoped_refptr<Extension> extension() { return extension_; }
51
52   // ExtensionSystem implementation:
53   virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE;
54   virtual ExtensionService* extension_service() OVERRIDE;
55   virtual RuntimeData* runtime_data() OVERRIDE;
56   virtual ManagementPolicy* management_policy() OVERRIDE;
57   virtual SharedUserScriptMaster* shared_user_script_master() OVERRIDE;
58   virtual ProcessManager* process_manager() OVERRIDE;
59   virtual StateStore* state_store() OVERRIDE;
60   virtual StateStore* rules_store() OVERRIDE;
61   virtual InfoMap* info_map() OVERRIDE;
62   virtual LazyBackgroundTaskQueue* lazy_background_task_queue() OVERRIDE;
63   virtual EventRouter* event_router() OVERRIDE;
64   virtual WarningService* warning_service() OVERRIDE;
65   virtual Blacklist* blacklist() OVERRIDE;
66   virtual ErrorConsole* error_console() OVERRIDE;
67   virtual InstallVerifier* install_verifier() OVERRIDE;
68   virtual QuotaService* quota_service() OVERRIDE;
69   virtual void RegisterExtensionWithRequestContexts(
70       const Extension* extension) OVERRIDE;
71   virtual void UnregisterExtensionWithRequestContexts(
72       const std::string& extension_id,
73       const UnloadedExtensionInfo::Reason reason) OVERRIDE;
74   virtual const OneShotEvent& ready() const OVERRIDE;
75   virtual ContentVerifier* content_verifier() OVERRIDE;
76   virtual scoped_ptr<ExtensionSet> GetDependentExtensions(
77       const Extension* extension) OVERRIDE;
78   virtual DeclarativeUserScriptMaster*
79       GetDeclarativeUserScriptMasterByExtension(
80           const ExtensionId& extension_id) OVERRIDE;
81
82  private:
83   content::BrowserContext* browser_context_;  // Not owned.
84
85   // Extension ID for the app.
86   std::string app_id_;
87
88   scoped_refptr<Extension> extension_;
89
90   // Data to be accessed on the IO thread. Must outlive process_manager_.
91   scoped_refptr<InfoMap> info_map_;
92
93   scoped_ptr<RuntimeData> runtime_data_;
94   scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_;
95   scoped_ptr<EventRouter> event_router_;
96   scoped_ptr<ProcessManager> process_manager_;
97   scoped_ptr<QuotaService> quota_service_;
98
99   // Signaled when the extension system has completed its startup tasks.
100   OneShotEvent ready_;
101
102   DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem);
103 };
104
105 }  // namespace extensions
106
107 #endif  // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_