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

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: Wrap Missing Permission string in #ifdef AURA Created 6 years, 7 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 4f2b68eaf5672670e0a9279fb614087e130a07c2..9d57308fb7fe4de8cbc164cdbea2c6891e003a36 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -50,6 +50,11 @@ const char kInactiveColorWithoutColor[] =
"frame.inactiveColor must be used with frame.color.";
const char kConflictingBoundsOptions[] =
"The $1 property cannot be specified for both inner and outer bounds.";
+
+#if defined(USE_AURA)
+const char kMissingPermissionAlphaEnabled[] =
+ "The alphaEnabled option requires app.window.alpha permission.";
+#endif
} // namespace app_window_constants
const char kNoneFrameOption[] = "none";
@@ -223,12 +228,30 @@ bool AppWindowCreateFunction::RunAsync() {
if (!GetFrameOptions(*options, &create_params))
return false;
- if (options->transparent_background.get() &&
- (GetExtension()->HasAPIPermission(APIPermission::kExperimental) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalExtensionApis))) {
- create_params.transparent_background = *options->transparent_background;
+#if defined(USE_AURA)
benwells 2014/05/12 04:25:17 Why is this gated on aura? If you try to use this
garykac 2014/07/09 23:19:21 Done.
+ if (options->alpha_enabled.get()) {
+ bool allow_alpha_enabled = false;
+ // For now, continue to support this if Experimental is set (any channel).
+ // TODO(garykac) Remove this once the permission moves to stable.
+ if (GetExtension()->HasAPIPermission(APIPermission::kExperimental) ||
benwells 2014/05/12 04:25:17 After thinking about it I'd prefer to remove acces
garykac 2014/07/09 23:19:21 I don't know of any apps. Removed.
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalExtensionApis)) {
+ allow_alpha_enabled = true;
+ }
+ // Support alphaEnabled permission on dev channel.
+ if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) {
benwells 2014/05/12 04:25:17 There should also be an error if the user tries to
garykac 2014/07/09 23:19:21 Done. Handled in the _permission_features.json.
+ if (GetExtension()->HasAPIPermission(APIPermission::kAlphaEnabled)) {
+ allow_alpha_enabled = true;
+ } else {
+ error_ = app_window_constants::kMissingPermissionAlphaEnabled;
+ return false;
+ }
+ }
+ if (allow_alpha_enabled) {
+ create_params.alpha_enabled = *options->alpha_enabled;
+ }
}
+#endif
if (options->hidden.get())
create_params.hidden = *options->hidden.get();

Powered by Google App Engine
This is Rietveld 408576698