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 "apps/shell/browser/shell_app_runtime_api.h" | 9 #include "apps/shell/browser/shell_app_runtime_api.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" | |
13 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
18 #include "extensions/browser/event_router.h" | 17 #include "extensions/browser/event_router.h" |
19 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
20 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
21 #include "extensions/browser/info_map.h" | 20 #include "extensions/browser/info_map.h" |
22 #include "extensions/browser/lazy_background_task_queue.h" | 21 #include "extensions/browser/lazy_background_task_queue.h" |
23 #include "extensions/browser/process_manager.h" | 22 #include "extensions/browser/process_manager.h" |
24 #include "extensions/browser/quota_service.h" | 23 #include "extensions/browser/quota_service.h" |
25 #include "extensions/browser/runtime_data.h" | 24 #include "extensions/browser/runtime_data.h" |
| 25 #include "extensions/common/file_util.h" |
26 | 26 |
27 using content::BrowserContext; | 27 using content::BrowserContext; |
28 using content::BrowserThread; | 28 using content::BrowserThread; |
29 | 29 |
30 namespace extensions { | 30 namespace extensions { |
31 | 31 |
32 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) | 32 ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) |
33 : browser_context_(browser_context) { | 33 : browser_context_(browser_context) { |
34 } | 34 } |
35 | 35 |
36 ShellExtensionSystem::~ShellExtensionSystem() { | 36 ShellExtensionSystem::~ShellExtensionSystem() { |
37 } | 37 } |
38 | 38 |
39 bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { | 39 bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { |
40 std::string load_error; | 40 std::string load_error; |
41 scoped_refptr<Extension> extension = | 41 scoped_refptr<Extension> extension = file_util::LoadExtension( |
42 extension_file_util::LoadExtension(app_dir, | 42 app_dir, Manifest::COMMAND_LINE, Extension::NO_FLAGS, &load_error); |
43 extensions::Manifest::COMMAND_LINE, | |
44 Extension::NO_FLAGS, | |
45 &load_error); | |
46 if (!extension) { | 43 if (!extension) { |
47 LOG(ERROR) << "Loading extension at " << app_dir.value() | 44 LOG(ERROR) << "Loading extension at " << app_dir.value() |
48 << " failed with: " << load_error; | 45 << " failed with: " << load_error; |
49 return false; | 46 return false; |
50 } | 47 } |
51 app_id_ = extension->id(); | 48 app_id_ = extension->id(); |
52 | 49 |
53 // TODO(jamescook): We may want to do some of these things here: | 50 // TODO(jamescook): We may want to do some of these things here: |
54 // * Create a PermissionsUpdater. | 51 // * Create a PermissionsUpdater. |
55 // * Call PermissionsUpdater::GrantActivePermissions(). | 52 // * Call PermissionsUpdater::GrantActivePermissions(). |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( | 165 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( |
169 const std::string& extension_id, | 166 const std::string& extension_id, |
170 const UnloadedExtensionInfo::Reason reason) { | 167 const UnloadedExtensionInfo::Reason reason) { |
171 } | 168 } |
172 | 169 |
173 const OneShotEvent& ShellExtensionSystem::ready() const { | 170 const OneShotEvent& ShellExtensionSystem::ready() const { |
174 return ready_; | 171 return ready_; |
175 } | 172 } |
176 | 173 |
177 } // namespace extensions | 174 } // namespace extensions |
OLD | NEW |