Chromium Code Reviews| Index: extensions/browser/api/app_window/app_window_api.cc |
| diff --git a/extensions/browser/api/app_window/app_window_api.cc b/extensions/browser/api/app_window/app_window_api.cc |
| index 56962426cd3be9c1811fc088bb6b833077730bfe..c8416de2243ef33581bbbced6b447ff7630208fa 100644 |
| --- a/extensions/browser/api/app_window/app_window_api.cc |
| +++ b/extensions/browser/api/app_window/app_window_api.cc |
| @@ -27,6 +27,7 @@ |
| #include "extensions/browser/app_window/app_window_registry.h" |
| #include "extensions/browser/app_window/native_app_window.h" |
| #include "extensions/browser/extensions_browser_client.h" |
| +#include "extensions/common/api/app_runtime.h" |
| #include "extensions/common/api/app_window.h" |
| #include "extensions/common/features/simple_feature.h" |
| #include "extensions/common/image_util.h" |
| @@ -356,11 +357,37 @@ ExtensionFunction::ResponseAction AppWindowCreateFunction::Run() { |
| } |
| } |
| + api::app_runtime::ActionType action_type = api::app_runtime::ACTION_TYPE_NONE; |
| + if ((options && |
| + options->lock_screen_action != api::app_runtime::ACTION_TYPE_NONE)) { |
| + if (source_context_type() != Feature::LOCK_SCREEN_EXTENSION_CONTEXT) { |
| + return RespondNow(Error( |
| + "The lockScreenAction option requires lock screen app context.")); |
| + } |
| + |
| + if (!extension()->permissions_data()->HasAPIPermission( |
| + APIPermission::kLockScreen)) { |
| + return RespondNow( |
| + Error("The lockScreenAction option requires lockScreen permission.")); |
| + } |
| + |
| + action_type = options->lock_screen_action; |
| + create_params.show_on_lock_screen = true; |
| + } |
| + |
| create_params.creator_process_id = |
| render_frame_host()->GetProcess()->GetID(); |
| AppWindow* app_window = |
| - AppWindowClient::Get()->CreateAppWindow(browser_context(), extension()); |
| + action_type != api::app_runtime::ACTION_TYPE_NONE |
|
benwells
2017/06/13 10:30:46
This ternary is a bit out of control. I think it w
tbarzic
2017/06/13 19:17:59
Done.
|
| + ? AppWindowClient::Get()->CreateAppWindowForLockScreenAction( |
| + browser_context(), extension(), action_type) |
| + : AppWindowClient::Get()->CreateAppWindow(browser_context(), |
| + extension()); |
| + |
| + if (!app_window) |
| + return RespondNow(Error("Failed to create the app window.")); |
| + |
| app_window->Init(url, new AppWindowContentsImpl(app_window), |
| render_frame_host(), create_params); |