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

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

Issue 274123003: Enabling alwaysOnTop should fail to create app windows if the permission is lacking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/windows_api_always_on_top/no_permissions/background.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63c40c0cee24d7d4849f528d714615b3ddd6b3c6..cba35a267eaa680dc13001bebeb3f8924d9c6655 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -48,6 +48,8 @@ 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.";
+const char kAlwaysOnTopPermission[] =
+ "The \"app.window.alwaysOnTop\" permission is required.";
} // namespace app_window_constants
const char kNoneFrameOption[] = "none";
@@ -234,10 +236,16 @@ bool AppWindowCreateFunction::RunAsync() {
if (options->resizable.get())
create_params.resizable = *options->resizable.get();
- if (options->always_on_top.get() &&
- GetExtension()->HasAPIPermission(APIPermission::kAlwaysOnTopWindows))
+ if (options->always_on_top.get()) {
create_params.always_on_top = *options->always_on_top.get();
+ if (create_params.always_on_top && !GetExtension()->HasAPIPermission(
+ APIPermission::kAlwaysOnTopWindows)) {
+ error_ = app_window_constants::kAlwaysOnTopPermission;
+ return false;
+ }
+ }
+
if (options->focused.get())
create_params.focused = *options->focused.get();
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/windows_api_always_on_top/no_permissions/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698