Chromium Code Reviews| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
| 26 #include "extensions/browser/api/app_runtime/app_runtime_api.h" | 26 #include "extensions/browser/api/app_runtime/app_runtime_api.h" |
| 27 #include "extensions/browser/event_router.h" | 27 #include "extensions/browser/event_router.h" |
| 28 #include "extensions/browser/extension_host.h" | 28 #include "extensions/browser/extension_host.h" |
| 29 #include "extensions/browser/extension_prefs.h" | 29 #include "extensions/browser/extension_prefs.h" |
| 30 #include "extensions/browser/extension_registry.h" | 30 #include "extensions/browser/extension_registry.h" |
| 31 #include "extensions/browser/extension_system.h" | |
| 32 #include "extensions/browser/granted_file_entry.h" | 31 #include "extensions/browser/granted_file_entry.h" |
| 33 #include "extensions/browser/lazy_background_task_queue.h" | 32 #include "extensions/browser/lazy_background_task_queue.h" |
| 34 #include "extensions/browser/process_manager.h" | 33 #include "extensions/browser/process_manager.h" |
| 35 #include "extensions/common/api/app_runtime.h" | 34 #include "extensions/common/api/app_runtime.h" |
| 36 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 37 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 36 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 38 #include "net/base/filename_util.h" | 37 #include "net/base/filename_util.h" |
| 39 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
| 40 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| 41 | 40 |
| 42 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 43 #include "components/user_manager/user_manager.h" | 42 #include "components/user_manager/user_manager.h" |
| 44 #endif | 43 #endif |
| 45 | 44 |
| 46 namespace app_runtime = extensions::core_api::app_runtime; | 45 namespace app_runtime = extensions::core_api::app_runtime; |
| 47 | 46 |
| 48 using content::BrowserThread; | 47 using content::BrowserThread; |
| 49 using extensions::AppRuntimeEventRouter; | 48 using extensions::AppRuntimeEventRouter; |
| 50 using extensions::app_file_handler_util::CreateFileEntry; | 49 using extensions::app_file_handler_util::CreateFileEntry; |
| 51 using extensions::app_file_handler_util::FileHandlerCanHandleFile; | 50 using extensions::app_file_handler_util::FileHandlerCanHandleFile; |
| 52 using extensions::app_file_handler_util::FileHandlerForId; | 51 using extensions::app_file_handler_util::FileHandlerForId; |
| 53 using extensions::app_file_handler_util::FirstFileHandlerForFile; | 52 using extensions::app_file_handler_util::FirstFileHandlerForFile; |
| 54 using extensions::app_file_handler_util::HasFileSystemWritePermission; | 53 using extensions::app_file_handler_util::HasFileSystemWritePermission; |
| 55 using extensions::app_file_handler_util::PrepareFilesForWritableApp; | 54 using extensions::app_file_handler_util::PrepareFilesForWritableApp; |
| 56 using extensions::EventRouter; | 55 using extensions::EventRouter; |
| 57 using extensions::Extension; | 56 using extensions::Extension; |
| 58 using extensions::ExtensionHost; | 57 using extensions::ExtensionHost; |
| 59 using extensions::ExtensionSystem; | 58 //using extensions::ExtensionSystem; |
|
asargent_no_longer_on_chrome
2015/05/14 21:13:55
nit: did you mean to remove this line, instead of
juncai
2015/05/16 00:46:40
Done.
| |
| 60 using extensions::GrantedFileEntry; | 59 using extensions::GrantedFileEntry; |
| 61 | 60 |
| 62 namespace apps { | 61 namespace apps { |
| 63 | 62 |
| 64 namespace { | 63 namespace { |
| 65 | 64 |
| 66 const char kFallbackMimeType[] = "application/octet-stream"; | 65 const char kFallbackMimeType[] = "application/octet-stream"; |
| 67 | 66 |
| 68 bool DoMakePathAbsolute(const base::FilePath& current_directory, | 67 bool DoMakePathAbsolute(const base::FilePath& current_directory, |
| 69 base::FilePath* file_path) { | 68 base::FilePath* file_path) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 | 253 |
| 255 if (handler_id_.empty()) | 254 if (handler_id_.empty()) |
| 256 handler_id_ = handler->id; | 255 handler_id_ = handler->id; |
| 257 | 256 |
| 258 // Access needs to be granted to the file for the process associated with | 257 // Access needs to be granted to the file for the process associated with |
| 259 // the extension. To do this the ExtensionHost is needed. This might not be | 258 // the extension. To do this the ExtensionHost is needed. This might not be |
| 260 // available, or it might be in the process of being unloaded, in which case | 259 // available, or it might be in the process of being unloaded, in which case |
| 261 // the lazy background task queue is used to load the extension and then | 260 // the lazy background task queue is used to load the extension and then |
| 262 // call back to us. | 261 // call back to us. |
| 263 extensions::LazyBackgroundTaskQueue* const queue = | 262 extensions::LazyBackgroundTaskQueue* const queue = |
| 264 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); | 263 extensions::LazyBackgroundTaskQueue::Get(profile_); |
| 265 if (queue->ShouldEnqueueTask(profile_, extension)) { | 264 if (queue->ShouldEnqueueTask(profile_, extension)) { |
| 266 queue->AddPendingTask( | 265 queue->AddPendingTask( |
| 267 profile_, extension_id, | 266 profile_, extension_id, |
| 268 base::Bind(&PlatformAppPathLauncher::GrantAccessToFilesAndLaunch, | 267 base::Bind(&PlatformAppPathLauncher::GrantAccessToFilesAndLaunch, |
| 269 this)); | 268 this)); |
| 270 return; | 269 return; |
| 271 } | 270 } |
| 272 | 271 |
| 273 extensions::ProcessManager* const process_manager = | 272 extensions::ProcessManager* const process_manager = |
| 274 extensions::ProcessManager::Get(profile_); | 273 extensions::ProcessManager::Get(profile_); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 void LaunchPlatformAppWithUrl(Profile* profile, | 424 void LaunchPlatformAppWithUrl(Profile* profile, |
| 426 const Extension* extension, | 425 const Extension* extension, |
| 427 const std::string& handler_id, | 426 const std::string& handler_id, |
| 428 const GURL& url, | 427 const GURL& url, |
| 429 const GURL& referrer_url) { | 428 const GURL& referrer_url) { |
| 430 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( | 429 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( |
| 431 profile, extension, handler_id, url, referrer_url); | 430 profile, extension, handler_id, url, referrer_url); |
| 432 } | 431 } |
| 433 | 432 |
| 434 } // namespace apps | 433 } // namespace apps |
| OLD | NEW |