Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2785)

Unified Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 190533006: Add support for transparent background API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac (no-Aura) browsertest Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 199fbf4b9afcf5c70f65f9c120e15ee1d71df112..4ad6d10e962c96a30bdefa557a1a22389c7186df 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -54,6 +54,15 @@ const char kAlwaysOnTopPermission[] =
"The \"app.window.alwaysOnTop\" permission is required.";
const char kInvalidUrlParameter[] =
"The URL used for window creation must be local for security reasons.";
+
+const char kAlphaEnabledMissingPermission[] =
+ "The alphaEnabled option requires app.window.alpha permission.";
+#if !defined(USE_AURA)
jackhou1 2014/07/22 05:35:35 It might be better to just allow apps to set this
garykac 2014/07/25 22:50:31 Done. Actually, that matches the current doc for
jackhou1 2014/07/29 23:39:10 Oops, I should have been clearer. We should probab
garykac 2014/08/04 23:11:53 Done.
+const char kAlphaEnabledNotSupported[] =
+ "Alpha-blended windows are not supported on this platform.";
+#endif
+const char kAlphaEnabledWrongChannel[] =
+ "The alphaEnabled option requires beta channel or newer.";
} // namespace app_window_constants
const char kNoneFrameOption[] = "none";
@@ -232,12 +241,22 @@ bool AppWindowCreateFunction::RunAsync() {
if (!GetFrameOptions(*options, &create_params))
return false;
- if (options->transparent_background.get() &&
- (GetExtension()->permissions_data()->HasAPIPermission(
- APIPermission::kExperimental) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalExtensionApis))) {
- create_params.transparent_background = *options->transparent_background;
+ if (options->alpha_enabled.get()) {
+ if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_BETA) {
+ error_ = app_window_constants::kAlphaEnabledWrongChannel;
+ return false;
+ }
+ if (!GetExtension()->permissions_data()->HasAPIPermission(
+ APIPermission::kAlphaEnabled)) {
+ error_ = app_window_constants::kAlphaEnabledMissingPermission;
+ return false;
+ }
+#if !defined(USE_AURA)
+ error_ = app_window_constants::kAlphaEnabledNotSupported;
+ return false;
+#else
+ create_params.alpha_enabled = *options->alpha_enabled;
+#endif
}
if (options->hidden.get())

Powered by Google App Engine
This is Rietveld 408576698