OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "apps/shell/browser/shell_extension_system.h" | 5 #include "apps/shell/browser/shell_extension_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/common/extensions/extension_file_util.h" | 12 #include "chrome/common/extensions/extension_file_util.h" |
13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
18 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
20 #include "extensions/browser/extension_prefs_factory.h" | |
21 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
22 #include "extensions/browser/extension_registry_factory.h" | |
23 #include "extensions/browser/info_map.h" | 21 #include "extensions/browser/info_map.h" |
24 #include "extensions/browser/lazy_background_task_queue.h" | 22 #include "extensions/browser/lazy_background_task_queue.h" |
25 #include "extensions/browser/process_manager.h" | 23 #include "extensions/browser/process_manager.h" |
26 #include "extensions/browser/quota_service.h" | 24 #include "extensions/browser/quota_service.h" |
27 #include "extensions/browser/runtime_data.h" | 25 #include "extensions/browser/runtime_data.h" |
28 | 26 |
29 using content::BrowserContext; | 27 using content::BrowserContext; |
30 using content::BrowserThread; | 28 using content::BrowserThread; |
31 | 29 |
32 namespace extensions { | 30 namespace extensions { |
33 | 31 |
34 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) | 32 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) |
35 : browser_context_(browser_context) { | 33 : browser_context_(browser_context) { |
36 } | 34 } |
37 | 35 |
38 ShellExtensionSystem::~ShellExtensionSystem() { | 36 ShellExtensionSystem::~ShellExtensionSystem() { |
39 } | 37 } |
40 | 38 |
41 // static | |
42 std::vector<BrowserContextKeyedServiceFactory*> | |
43 ShellExtensionSystem::GetDependencies() { | |
44 std::vector<BrowserContextKeyedServiceFactory*> depends_on; | |
45 depends_on.push_back(ExtensionPrefsFactory::GetInstance()); | |
46 depends_on.push_back(ExtensionRegistryFactory::GetInstance()); | |
47 return depends_on; | |
48 } | |
49 | |
50 bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { | 39 bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { |
51 std::string load_error; | 40 std::string load_error; |
52 scoped_refptr<Extension> extension = | 41 scoped_refptr<Extension> extension = |
53 extension_file_util::LoadExtension(app_dir, | 42 extension_file_util::LoadExtension(app_dir, |
54 extensions::Manifest::COMMAND_LINE, | 43 extensions::Manifest::COMMAND_LINE, |
55 Extension::NO_FLAGS, | 44 Extension::NO_FLAGS, |
56 &load_error); | 45 &load_error); |
57 if (!extension) { | 46 if (!extension) { |
58 LOG(ERROR) << "Loading extension at " << app_dir.value() | 47 LOG(ERROR) << "Loading extension at " << app_dir.value() |
59 << " failed with: " << load_error; | 48 << " failed with: " << load_error; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( | 174 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( |
186 const std::string& extension_id, | 175 const std::string& extension_id, |
187 const UnloadedExtensionInfo::Reason reason) { | 176 const UnloadedExtensionInfo::Reason reason) { |
188 } | 177 } |
189 | 178 |
190 const OneShotEvent& ShellExtensionSystem::ready() const { | 179 const OneShotEvent& ShellExtensionSystem::ready() const { |
191 return ready_; | 180 return ready_; |
192 } | 181 } |
193 | 182 |
194 } // namespace extensions | 183 } // namespace extensions |
OLD | NEW |