Chromium Code Reviews| Index: chrome/browser/extensions/api/app_window/app_window_api.cc |
| diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc |
| index 9b591a71f558bba21bcae2da008b0a17826940b4..724d845b77a284cecdff451696d23eb27365fb16 100644 |
| --- a/chrome/browser/extensions/api/app_window/app_window_api.cc |
| +++ b/chrome/browser/extensions/api/app_window/app_window_api.cc |
| @@ -23,6 +23,7 @@ |
| #include "extensions/browser/app_window/native_app_window.h" |
| #include "extensions/browser/extensions_browser_client.h" |
| #include "extensions/browser/image_util.h" |
| +#include "extensions/common/manifest.h" |
| #include "extensions/common/features/simple_feature.h" |
| #include "extensions/common/permissions/permissions_data.h" |
| #include "extensions/common/switches.h" |
| @@ -56,6 +57,18 @@ const char kAlphaEnabledMissingPermission[] = |
| "The alphaEnabled option requires app.window.alpha permission."; |
| const char kAlphaEnabledNeedsFrameNone[] = |
| "The alphaEnabled option can only be used with \"frame: 'none'\"."; |
| +const char kImeOptionIsRequired[] = |
| + "The ime option must be set for non platform app."; |
| +const char kImeWindowMissingPermission[] = |
| + "The ime option requires app.window.ime permission."; |
| +const char kImeWindowNeedsFrameNone[] = |
| + "The ime option can only be used with \"frame: 'none'\"."; |
| +const char kImeOptionIsNotSupported[] = |
| + "The ime option is not supported for platform app."; |
| +#if !defined(OS_CHROMEOS) |
| +const char kImeWindowUnsupportedPlatform[] = |
| + "The ime option can only be used on ChromeOS."; |
| +#endif |
| } // namespace app_window_constants |
| const char kNoneFrameOption[] = "none"; |
| @@ -203,6 +216,34 @@ bool AppWindowCreateFunction::RunAsync() { |
| if (!GetFrameOptions(*options, &create_params)) |
| return false; |
| + if (extension()->GetType() == extensions::Manifest::TYPE_PLATFORM_APP) { |
|
jackhou1
2014/09/12 03:24:51
Prior to this, this entire function assumed TYPE_P
bshe
2014/09/12 17:44:12
Done.
|
| + if (options->ime.get()) { |
| + error_ = app_window_constants::kImeOptionIsNotSupported; |
| + return false; |
| + } |
| + } else { |
| +#if defined(OS_CHROMEOS) |
| + if (!options->ime.get()) { |
|
jackhou1
2014/09/12 03:24:51
IIUC, extensions can only ever use chrome.app.wind
bshe
2014/09/12 17:44:12
Done.
|
| + error_ = app_window_constants::kImeOptionIsRequired; |
| + return false; |
| + } |
| + if (!extension()->permissions_data()->HasAPIPermission( |
| + APIPermission::kImeWindowEnabled)) { |
| + error_ = app_window_constants::kImeWindowMissingPermission; |
| + return false; |
| + } |
| + if (create_params.frame != AppWindow::FRAME_NONE) { |
| + error_ = app_window_constants::kImeWindowNeedsFrameNone; |
| + return false; |
| + } |
| + create_params.is_ime_window = *options->ime; |
| +#else |
| + // IME window is only supported on ChromeOS. |
| + error_ = app_window_constants::kImeWindowUnsupportedPlatform; |
| + return false; |
| +#endif |
| + } |
| + |
| if (options->alpha_enabled.get()) { |
| const char* whitelist[] = { |
| "0F42756099D914A026DADFA182871C015735DD95", // http://crbug.com/323773 |