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 <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "extensions/browser/event_router.h" | 30 #include "extensions/browser/event_router.h" |
31 #include "extensions/browser/extension_host.h" | 31 #include "extensions/browser/extension_host.h" |
32 #include "extensions/browser/extension_prefs.h" | 32 #include "extensions/browser/extension_prefs.h" |
33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
34 #include "extensions/browser/granted_file_entry.h" | 34 #include "extensions/browser/granted_file_entry.h" |
35 #include "extensions/browser/lazy_background_task_queue.h" | 35 #include "extensions/browser/lazy_background_task_queue.h" |
36 #include "extensions/browser/process_manager.h" | 36 #include "extensions/browser/process_manager.h" |
37 #include "extensions/common/api/app_runtime.h" | 37 #include "extensions/common/api/app_runtime.h" |
38 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
39 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 39 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 40 #include "extensions/common/permissions/api_permission.h" |
| 41 #include "extensions/common/permissions/permissions_data.h" |
40 #include "net/base/filename_util.h" | 42 #include "net/base/filename_util.h" |
41 #include "url/gurl.h" | 43 #include "url/gurl.h" |
42 | 44 |
43 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
44 #include "components/user_manager/user_manager.h" | 46 #include "components/user_manager/user_manager.h" |
45 #endif | 47 #endif |
46 | 48 |
47 namespace app_runtime = extensions::api::app_runtime; | 49 namespace app_runtime = extensions::api::app_runtime; |
48 | 50 |
49 using content::BrowserThread; | 51 using content::BrowserThread; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 scoped_refptr<PlatformAppPathLauncher> launcher = | 429 scoped_refptr<PlatformAppPathLauncher> launcher = |
428 new PlatformAppPathLauncher(context, app, file_path); | 430 new PlatformAppPathLauncher(context, app, file_path); |
429 launcher->Launch(); | 431 launcher->Launch(); |
430 } | 432 } |
431 | 433 |
432 void LaunchPlatformAppWithAction( | 434 void LaunchPlatformAppWithAction( |
433 content::BrowserContext* context, | 435 content::BrowserContext* context, |
434 const extensions::Extension* app, | 436 const extensions::Extension* app, |
435 std::unique_ptr<app_runtime::ActionData> action_data, | 437 std::unique_ptr<app_runtime::ActionData> action_data, |
436 const base::FilePath& file_path) { | 438 const base::FilePath& file_path) { |
| 439 CHECK(!action_data || !action_data->is_lock_screen_action || |
| 440 !*action_data->is_lock_screen_action || |
| 441 app->permissions_data()->HasAPIPermission( |
| 442 extensions::APIPermission::kLockScreen)) |
| 443 << "Launching lock screen action handler requires lockScreen permission."; |
| 444 |
437 scoped_refptr<PlatformAppPathLauncher> launcher = | 445 scoped_refptr<PlatformAppPathLauncher> launcher = |
438 new PlatformAppPathLauncher(context, app, file_path); | 446 new PlatformAppPathLauncher(context, app, file_path); |
439 launcher->set_action_data(std::move(action_data)); | 447 launcher->set_action_data(std::move(action_data)); |
440 launcher->set_launch_source(extensions::AppLaunchSource::SOURCE_UNTRACKED); | 448 launcher->set_launch_source(extensions::AppLaunchSource::SOURCE_UNTRACKED); |
441 launcher->Launch(); | 449 launcher->Launch(); |
442 } | 450 } |
443 | 451 |
444 void LaunchPlatformApp(content::BrowserContext* context, | 452 void LaunchPlatformApp(content::BrowserContext* context, |
445 const Extension* app, | 453 const Extension* app, |
446 extensions::AppLaunchSource source) { | 454 extensions::AppLaunchSource source) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 void LaunchPlatformAppWithUrl(content::BrowserContext* context, | 494 void LaunchPlatformAppWithUrl(content::BrowserContext* context, |
487 const Extension* app, | 495 const Extension* app, |
488 const std::string& handler_id, | 496 const std::string& handler_id, |
489 const GURL& url, | 497 const GURL& url, |
490 const GURL& referrer_url) { | 498 const GURL& referrer_url) { |
491 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( | 499 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( |
492 context, app, handler_id, url, referrer_url); | 500 context, app, handler_id, url, referrer_url); |
493 } | 501 } |
494 | 502 |
495 } // namespace apps | 503 } // namespace apps |
OLD | NEW |