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 |
43 | 43 |
44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
45 #include "win8/util/win8_util.h" | 45 #include "win8/util/win8_util.h" |
46 #endif | 46 #endif |
47 | 47 |
48 namespace app_runtime = extensions::api::app_runtime; | 48 namespace app_runtime = extensions::api::app_runtime; |
49 | 49 |
50 using content::BrowserThread; | 50 using content::BrowserThread; |
51 using extensions::app_file_handler_util::CheckWritableFiles; | 51 using extensions::app_file_handler_util::CheckWritableFiles; |
52 using extensions::app_file_handler_util::FileHandlerForId; | 52 using extensions::app_file_handler_util::FileHandlerForId; |
53 using extensions::app_file_handler_util::FileHandlerCanHandleFile; | 53 using extensions::app_file_handler_util::FileHandlerCanHandleFile; |
54 using extensions::app_file_handler_util::FirstFileHandlerForFile; | 54 using extensions::app_file_handler_util::FirstFileHandlerForFile; |
55 using extensions::app_file_handler_util::CreateFileEntry; | 55 using extensions::app_file_handler_util::CreateFileEntry; |
56 using extensions::app_file_handler_util::GrantedFileEntry; | 56 using extensions::app_file_handler_util::GrantedFileEntry; |
57 using extensions::app_file_handler_util::HasFileSystemWritePermission; | 57 using extensions::app_file_handler_util::HasFileSystemWritePermission; |
58 using extensions::Extension; | 58 using extensions::Extension; |
59 using extensions::ExtensionHost; | 59 using extensions::ExtensionHost; |
60 using extensions::ExtensionSystem; | 60 using extensions::ExtensionSystem; |
61 | 61 |
62 //jamesdebug | |
miket_OOO
2013/11/07 20:24:52
Remove me!
| |
63 | |
62 namespace apps { | 64 namespace apps { |
63 | 65 |
64 namespace { | 66 namespace { |
65 | 67 |
66 const char kFallbackMimeType[] = "application/octet-stream"; | 68 const char kFallbackMimeType[] = "application/octet-stream"; |
67 | 69 |
68 bool MakePathAbsolute(const base::FilePath& current_directory, | 70 bool MakePathAbsolute(const base::FilePath& current_directory, |
69 base::FilePath* file_path) { | 71 base::FilePath* file_path) { |
70 DCHECK(file_path); | 72 DCHECK(file_path); |
71 if (file_path->IsAbsolute()) | 73 if (file_path->IsAbsolute()) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // call back to us. | 265 // call back to us. |
264 extensions::LazyBackgroundTaskQueue* queue = | 266 extensions::LazyBackgroundTaskQueue* queue = |
265 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); | 267 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); |
266 if (queue->ShouldEnqueueTask(profile_, extension_)) { | 268 if (queue->ShouldEnqueueTask(profile_, extension_)) { |
267 queue->AddPendingTask(profile_, extension_->id(), base::Bind( | 269 queue->AddPendingTask(profile_, extension_->id(), base::Bind( |
268 &PlatformAppPathLauncher::GrantAccessToFileAndLaunch, | 270 &PlatformAppPathLauncher::GrantAccessToFileAndLaunch, |
269 this, mime_type)); | 271 this, mime_type)); |
270 return; | 272 return; |
271 } | 273 } |
272 | 274 |
273 ExtensionProcessManager* process_manager = | 275 extensions::ProcessManager* process_manager = |
274 ExtensionSystem::Get(profile_)->process_manager(); | 276 ExtensionSystem::Get(profile_)->process_manager(); |
275 ExtensionHost* host = | 277 ExtensionHost* host = |
276 process_manager->GetBackgroundHostForExtension(extension_->id()); | 278 process_manager->GetBackgroundHostForExtension(extension_->id()); |
277 DCHECK(host); | 279 DCHECK(host); |
278 GrantAccessToFileAndLaunch(mime_type, host); | 280 GrantAccessToFileAndLaunch(mime_type, host); |
279 } | 281 } |
280 | 282 |
281 void GrantAccessToFileAndLaunch(const std::string& mime_type, | 283 void GrantAccessToFileAndLaunch(const std::string& mime_type, |
282 ExtensionHost* host) { | 284 ExtensionHost* host) { |
283 // If there was an error loading the app page, |host| will be NULL. | 285 // 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, | 403 void LaunchPlatformAppWithUrl(Profile* profile, |
402 const Extension* extension, | 404 const Extension* extension, |
403 const std::string& handler_id, | 405 const std::string& handler_id, |
404 const GURL& url, | 406 const GURL& url, |
405 const GURL& referrer_url) { | 407 const GURL& referrer_url) { |
406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( | 408 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( |
407 profile, extension, handler_id, url, referrer_url); | 409 profile, extension, handler_id, url, referrer_url); |
408 } | 410 } |
409 | 411 |
410 } // namespace apps | 412 } // namespace apps |
OLD | NEW |