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 "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" | 15 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" |
15 #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" |
16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 17 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
17 #include "chrome/browser/extensions/event_router.h" | 18 #include "chrome/browser/extensions/event_router.h" |
18 #include "chrome/browser/extensions/extension_host.h" | 19 #include "chrome/browser/extensions/extension_host.h" |
19 #include "chrome/browser/extensions/extension_prefs.h" | 20 #include "chrome/browser/extensions/extension_prefs.h" |
20 #include "chrome/browser/extensions/extension_process_manager.h" | 21 #include "chrome/browser/extensions/extension_process_manager.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/extension_system.h" | 23 #include "chrome/browser/extensions/extension_system.h" |
23 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 24 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/apps/app_metro_infobar_delegate_win.h" | |
26 #include "chrome/common/extensions/api/app_runtime.h" | 26 #include "chrome/common/extensions/api/app_runtime.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
28 #include "chrome/common/extensions/extension_messages.h" | 28 #include "chrome/common/extensions/extension_messages.h" |
29 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" | 29 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" |
30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.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" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); | 308 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); |
309 }; | 309 }; |
310 | 310 |
311 } // namespace | 311 } // namespace |
312 | 312 |
313 void LaunchPlatformAppWithCommandLine(Profile* profile, | 313 void LaunchPlatformAppWithCommandLine(Profile* profile, |
314 const Extension* extension, | 314 const Extension* extension, |
315 const CommandLine* command_line, | 315 const CommandLine* command_line, |
316 const base::FilePath& current_directory) { | 316 const base::FilePath& current_directory) { |
317 #if defined(OS_WIN) | 317 if (!AppsClient::Get()->CheckAppLaunch(profile, extension)) |
318 // On Windows 8's single window Metro mode we can not launch platform apps. | |
319 // Offer to switch Chrome to desktop mode. | |
320 if (win8::IsSingleWindowMetroMode()) { | |
321 AppMetroInfoBarDelegateWin::Create( | |
322 profile, AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP, | |
323 extension->id()); | |
324 return; | 318 return; |
325 } | |
326 #endif | |
327 | 319 |
328 // An app with "kiosk_only" should not be installed and launched | 320 // An app with "kiosk_only" should not be installed and launched |
329 // outside of ChromeOS kiosk mode in the first place. This is a defensive | 321 // outside of ChromeOS kiosk mode in the first place. This is a defensive |
330 // check in case this scenario does occur. | 322 // check in case this scenario does occur. |
331 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { | 323 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { |
332 bool in_kiosk_mode = false; | 324 bool in_kiosk_mode = false; |
333 #if defined(OS_CHROMEOS) | 325 #if defined(OS_CHROMEOS) |
334 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 326 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
335 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); | 327 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); |
336 #endif | 328 #endif |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 void LaunchPlatformAppWithUrl(Profile* profile, | 401 void LaunchPlatformAppWithUrl(Profile* profile, |
410 const Extension* extension, | 402 const Extension* extension, |
411 const std::string& handler_id, | 403 const std::string& handler_id, |
412 const GURL& url, | 404 const GURL& url, |
413 const GURL& referrer_url) { | 405 const GURL& referrer_url) { |
414 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( | 406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( |
415 profile, extension, handler_id, url, referrer_url); | 407 profile, extension, handler_id, url, referrer_url); |
416 } | 408 } |
417 | 409 |
418 } // namespace apps | 410 } // namespace apps |
OLD | NEW |