Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / apps / shell / shell_extension_system.h
1 // Copyright 2013 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 APPS_SHELL_SHELL_EXTENSION_SYSTEM_H_
6 #define APPS_SHELL_SHELL_EXTENSION_SYSTEM_H_
7
8 #include <vector>
9
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/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 EventRouter;
27 class InfoMap;
28 class LazyBackgroundTaskQueue;
29 class ProcessManager;
30 class RendererStartupHelper;
31
32 // A simplified version of ExtensionSystem for app_shell. Allows
33 // app_shell to skip initialization of services it doesn't need.
34 class ShellExtensionSystem : public ExtensionSystem {
35  public:
36   explicit ShellExtensionSystem(content::BrowserContext* browser_context);
37   virtual ~ShellExtensionSystem();
38
39   // Returns the list of services on which |this| depends.
40   static std::vector<BrowserContextKeyedServiceFactory*> GetDependencies();
41
42   // Loads an unpacked application from a directory and attempts to launch it.
43   // Returns true on success.
44   bool LoadAndLaunchApp(const base::FilePath& app_dir);
45
46   // BrowserContextKeyedService implementation:
47   virtual void Shutdown() OVERRIDE;
48
49   // ExtensionSystem implementation:
50   virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE;
51   virtual ExtensionService* extension_service() OVERRIDE;
52   virtual RuntimeData* runtime_data() OVERRIDE;
53   virtual ManagementPolicy* management_policy() OVERRIDE;
54   virtual UserScriptMaster* user_script_master() OVERRIDE;
55   virtual ProcessManager* process_manager() OVERRIDE;
56   virtual StateStore* state_store() OVERRIDE;
57   virtual StateStore* rules_store() OVERRIDE;
58   virtual InfoMap* info_map() OVERRIDE;
59   virtual LazyBackgroundTaskQueue* lazy_background_task_queue()
60       OVERRIDE;
61   virtual EventRouter* event_router() OVERRIDE;
62   virtual ExtensionWarningService* warning_service() OVERRIDE;
63   virtual Blacklist* blacklist() OVERRIDE;
64   virtual ErrorConsole* error_console() OVERRIDE;
65   virtual InstallVerifier* install_verifier() OVERRIDE;
66   virtual void RegisterExtensionWithRequestContexts(
67       const Extension* extension) OVERRIDE;
68   virtual void UnregisterExtensionWithRequestContexts(
69       const std::string& extension_id,
70       const UnloadedExtensionInfo::Reason reason) OVERRIDE;
71   virtual const OneShotEvent& ready() const OVERRIDE;
72
73  private:
74   content::BrowserContext* browser_context_;  // Not owned.
75
76   // Data to be accessed on the IO thread. Must outlive process_manager_.
77   scoped_refptr<InfoMap> info_map_;
78
79   scoped_ptr<RuntimeData> runtime_data_;
80   scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_;
81   scoped_ptr<EventRouter> event_router_;
82   scoped_ptr<ProcessManager> process_manager_;
83
84   // Signaled when the extension system has completed its startup tasks.
85   OneShotEvent ready_;
86
87   DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem);
88 };
89
90 }  // namespace extensions
91
92 #endif  // APPS_SHELL_SHELL_EXTENSION_SYSTEM_H_