Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: extensions/shell/browser/shell_extension_system.h

Issue 642383003: Add the ability to load multiple apps into app_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "extensions/browser/extension_system.h" 11 #include "extensions/browser/extension_system.h"
12 #include "extensions/common/extension_set.h"
12 #include "extensions/common/one_shot_event.h" 13 #include "extensions/common/one_shot_event.h"
13 14
14 class BrowserContextKeyedServiceFactory; 15 class BrowserContextKeyedServiceFactory;
15 16
16 namespace base { 17 namespace base {
17 class FilePath; 18 class FilePath;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 class BrowserContext; 22 class BrowserContext;
22 } 23 }
23 24
24 namespace extensions { 25 namespace extensions {
25 26
26 class DeclarativeUserScriptMaster; 27 class DeclarativeUserScriptMaster;
27 class EventRouter; 28 class EventRouter;
28 class InfoMap; 29 class InfoMap;
29 class LazyBackgroundTaskQueue; 30 class LazyBackgroundTaskQueue;
30 class ProcessManager; 31 class ProcessManager;
31 class RendererStartupHelper; 32 class RendererStartupHelper;
32 class SharedUserScriptMaster; 33 class SharedUserScriptMaster;
33 34
34 // A simplified version of ExtensionSystem for app_shell. Allows 35 // A simplified version of ExtensionSystem for app_shell. Allows
35 // app_shell to skip initialization of services it doesn't need. 36 // app_shell to skip initialization of services it doesn't need.
36 class ShellExtensionSystem : public ExtensionSystem { 37 class ShellExtensionSystem : public ExtensionSystem {
37 public: 38 public:
38 explicit ShellExtensionSystem(content::BrowserContext* browser_context); 39 explicit ShellExtensionSystem(content::BrowserContext* browser_context);
39 ~ShellExtensionSystem() override; 40 ~ShellExtensionSystem() override;
40 41
41 // Loads an unpacked application from a directory. Returns true on success. 42 // Loads an unpacked application from a directory. Returns the extension on
42 bool LoadApp(const base::FilePath& app_dir); 43 // success, or null otherwise.
44 const Extension* LoadApp(const base::FilePath& app_dir);
45
46 // Initializes the extension system.
James Cook 2014/10/23 21:29:53 Document the meaning of the return value.
lfg 2014/10/23 22:04:05 Switched to a void function, since the return valu
47 bool Init();
43 48
44 // Launch the currently loaded app. 49 // Launch the currently loaded app.
James Cook 2014/10/23 21:29:53 Update comment please.
lfg 2014/10/23 22:04:05 Done.
45 void LaunchApp(); 50 void LaunchApp(const ExtensionId& extension_id);
46 51
47 // KeyedService implementation: 52 // KeyedService implementation:
48 void Shutdown() override; 53 void Shutdown() override;
49 54
50 scoped_refptr<Extension> extension() { return extension_; }
51
52 // ExtensionSystem implementation: 55 // ExtensionSystem implementation:
53 void InitForRegularProfile(bool extensions_enabled) override; 56 void InitForRegularProfile(bool extensions_enabled) override;
54 ExtensionService* extension_service() override; 57 ExtensionService* extension_service() override;
55 RuntimeData* runtime_data() override; 58 RuntimeData* runtime_data() override;
56 ManagementPolicy* management_policy() override; 59 ManagementPolicy* management_policy() override;
57 SharedUserScriptMaster* shared_user_script_master() override; 60 SharedUserScriptMaster* shared_user_script_master() override;
58 ProcessManager* process_manager() override; 61 ProcessManager* process_manager() override;
59 StateStore* state_store() override; 62 StateStore* state_store() override;
60 StateStore* rules_store() override; 63 StateStore* rules_store() override;
61 InfoMap* info_map() override; 64 InfoMap* info_map() override;
(...skipping 12 matching lines...) Expand all
74 const OneShotEvent& ready() const override; 77 const OneShotEvent& ready() const override;
75 ContentVerifier* content_verifier() override; 78 ContentVerifier* content_verifier() override;
76 scoped_ptr<ExtensionSet> GetDependentExtensions( 79 scoped_ptr<ExtensionSet> GetDependentExtensions(
77 const Extension* extension) override; 80 const Extension* extension) override;
78 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByExtension( 81 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByExtension(
79 const ExtensionId& extension_id) override; 82 const ExtensionId& extension_id) override;
80 83
81 private: 84 private:
82 content::BrowserContext* browser_context_; // Not owned. 85 content::BrowserContext* browser_context_; // Not owned.
83 86
84 // Extension ID for the app. 87 // Set with all loaded apps.
85 std::string app_id_; 88 ExtensionSet extensions_;
86
87 scoped_refptr<Extension> extension_;
88 89
89 // Data to be accessed on the IO thread. Must outlive process_manager_. 90 // Data to be accessed on the IO thread. Must outlive process_manager_.
90 scoped_refptr<InfoMap> info_map_; 91 scoped_refptr<InfoMap> info_map_;
91 92
92 scoped_ptr<RuntimeData> runtime_data_; 93 scoped_ptr<RuntimeData> runtime_data_;
93 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; 94 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_;
94 scoped_ptr<EventRouter> event_router_; 95 scoped_ptr<EventRouter> event_router_;
95 scoped_ptr<ProcessManager> process_manager_; 96 scoped_ptr<ProcessManager> process_manager_;
96 scoped_ptr<QuotaService> quota_service_; 97 scoped_ptr<QuotaService> quota_service_;
97 98
98 // Signaled when the extension system has completed its startup tasks. 99 // Signaled when the extension system has completed its startup tasks.
99 OneShotEvent ready_; 100 OneShotEvent ready_;
100 101
101 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem); 102 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem);
102 }; 103 };
103 104
104 } // namespace extensions 105 } // namespace extensions
105 106
106 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ 107 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698