OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/platform_app_launcher.h" | 5 #include "chrome/browser/extensions/platform_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" | 14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" |
15 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 15 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
17 #include "chrome/browser/extensions/extension_host.h" | 17 #include "chrome/browser/extensions/extension_host.h" |
18 #include "chrome/browser/extensions/extension_prefs.h" | 18 #include "chrome/browser/extensions/extension_prefs.h" |
19 #include "chrome/browser/extensions/extension_process_manager.h" | 19 #include "chrome/browser/extensions/extension_process_manager.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/extensions/extension_system.h" | 21 #include "chrome/browser/extensions/extension_system.h" |
22 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 22 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h" | 24 #include "chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h" |
| 25 #include "chrome/browser/web_applications/web_app.h" |
25 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_messages.h" | 27 #include "chrome/common/extensions/extension_messages.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
29 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
30 #include "net/base/mime_util.h" | 31 #include "net/base/mime_util.h" |
31 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
32 #include "webkit/fileapi/file_system_types.h" | 33 #include "webkit/fileapi/file_system_types.h" |
33 | 34 |
34 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 *path = absolute_path; | 90 *path = absolute_path; |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 // Helper method to launch the platform app |extension| with no data. This | 94 // Helper method to launch the platform app |extension| with no data. This |
94 // should be called in the fallback case, where it has been impossible to | 95 // should be called in the fallback case, where it has been impossible to |
95 // load or obtain file launch data. | 96 // load or obtain file launch data. |
96 void LaunchPlatformAppWithNoData(Profile* profile, const Extension* extension) { | 97 void LaunchPlatformAppWithNoData(Profile* profile, const Extension* extension) { |
97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 98 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
98 extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); | 99 extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); |
| 100 web_app::MaybeLaunchShortcut(profile, extension); |
99 } | 101 } |
100 | 102 |
101 // Class to handle launching of platform apps to open a specific path. | 103 // Class to handle launching of platform apps to open a specific path. |
102 // An instance of this class is created for each launch. The lifetime of these | 104 // An instance of this class is created for each launch. The lifetime of these |
103 // instances is managed by reference counted pointers. As long as an instance | 105 // instances is managed by reference counted pointers. As long as an instance |
104 // has outstanding tasks on a message queue it will be retained; once all | 106 // has outstanding tasks on a message queue it will be retained; once all |
105 // outstanding tasks are completed it will be deleted. | 107 // outstanding tasks are completed it will be deleted. |
106 class PlatformAppPathLauncher | 108 class PlatformAppPathLauncher |
107 : public base::RefCountedThreadSafe<PlatformAppPathLauncher> { | 109 : public base::RefCountedThreadSafe<PlatformAppPathLauncher> { |
108 public: | 110 public: |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void RestartPlatformAppWithFileEntries( | 403 void RestartPlatformAppWithFileEntries( |
402 Profile* profile, | 404 Profile* profile, |
403 const Extension* extension, | 405 const Extension* extension, |
404 const std::vector<SavedFileEntry>& file_entries) { | 406 const std::vector<SavedFileEntry>& file_entries) { |
405 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( | 407 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( |
406 profile, extension, file_entries); | 408 profile, extension, file_entries); |
407 launcher->Launch(); | 409 launcher->Launch(); |
408 } | 410 } |
409 | 411 |
410 } // namespace extensions | 412 } // namespace extensions |
OLD | NEW |