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/launcher.h" | 5 #include "apps/launcher.h" |
6 | 6 |
7 #include "apps/apps_client.h" | 7 #include "apps/apps_client.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" | 15 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" |
16 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 16 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
17 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 17 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
18 #include "chrome/browser/extensions/event_router.h" | 18 #include "chrome/browser/extensions/event_router.h" |
19 #include "chrome/browser/extensions/extension_host.h" | 19 #include "chrome/browser/extensions/extension_host.h" |
20 #include "chrome/browser/extensions/extension_prefs.h" | 20 #include "chrome/browser/extensions/extension_prefs.h" |
21 #include "chrome/browser/extensions/extension_process_manager.h" | |
22 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
24 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/common/extensions/api/app_runtime.h" | 24 #include "chrome/common/extensions/api/app_runtime.h" |
26 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
27 #include "chrome/common/extensions/extension_messages.h" | 26 #include "chrome/common/extensions/extension_messages.h" |
28 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" | 27 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" |
29 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
32 #include "extensions/browser/lazy_background_task_queue.h" | 31 #include "extensions/browser/lazy_background_task_queue.h" |
| 32 #include "extensions/browser/process_manager.h" |
33 #include "net/base/mime_util.h" | 33 #include "net/base/mime_util.h" |
34 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
35 #include "url/gurl.h" | 35 #include "url/gurl.h" |
36 | 36 |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 #include "chrome/browser/chromeos/drive/file_errors.h" | 38 #include "chrome/browser/chromeos/drive/file_errors.h" |
39 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 39 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
40 #include "chrome/browser/chromeos/drive/file_system_util.h" | 40 #include "chrome/browser/chromeos/drive/file_system_util.h" |
41 #include "chrome/browser/chromeos/login/user_manager.h" | 41 #include "chrome/browser/chromeos/login/user_manager.h" |
42 #endif | 42 #endif |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // call back to us. | 263 // call back to us. |
264 extensions::LazyBackgroundTaskQueue* queue = | 264 extensions::LazyBackgroundTaskQueue* queue = |
265 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); | 265 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); |
266 if (queue->ShouldEnqueueTask(profile_, extension_)) { | 266 if (queue->ShouldEnqueueTask(profile_, extension_)) { |
267 queue->AddPendingTask(profile_, extension_->id(), base::Bind( | 267 queue->AddPendingTask(profile_, extension_->id(), base::Bind( |
268 &PlatformAppPathLauncher::GrantAccessToFileAndLaunch, | 268 &PlatformAppPathLauncher::GrantAccessToFileAndLaunch, |
269 this, mime_type)); | 269 this, mime_type)); |
270 return; | 270 return; |
271 } | 271 } |
272 | 272 |
273 ExtensionProcessManager* process_manager = | 273 extensions::ProcessManager* process_manager = |
274 ExtensionSystem::Get(profile_)->process_manager(); | 274 ExtensionSystem::Get(profile_)->process_manager(); |
275 ExtensionHost* host = | 275 ExtensionHost* host = |
276 process_manager->GetBackgroundHostForExtension(extension_->id()); | 276 process_manager->GetBackgroundHostForExtension(extension_->id()); |
277 DCHECK(host); | 277 DCHECK(host); |
278 GrantAccessToFileAndLaunch(mime_type, host); | 278 GrantAccessToFileAndLaunch(mime_type, host); |
279 } | 279 } |
280 | 280 |
281 void GrantAccessToFileAndLaunch(const std::string& mime_type, | 281 void GrantAccessToFileAndLaunch(const std::string& mime_type, |
282 ExtensionHost* host) { | 282 ExtensionHost* host) { |
283 // If there was an error loading the app page, |host| will be NULL. | 283 // If there was an error loading the app page, |host| will be NULL. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void LaunchPlatformAppWithUrl(Profile* profile, | 401 void LaunchPlatformAppWithUrl(Profile* profile, |
402 const Extension* extension, | 402 const Extension* extension, |
403 const std::string& handler_id, | 403 const std::string& handler_id, |
404 const GURL& url, | 404 const GURL& url, |
405 const GURL& referrer_url) { | 405 const GURL& referrer_url) { |
406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( | 406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( |
407 profile, extension, handler_id, url, referrer_url); | 407 profile, extension, handler_id, url, referrer_url); |
408 } | 408 } |
409 | 409 |
410 } // namespace apps | 410 } // namespace apps |
OLD | NEW |