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

Unified Diff: chrome/browser/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.cc

Issue 2858013002: PS - Showing permission prompt for activeTab (Closed)
Patch Set: Rebase Created 3 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/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.cc
diff --git a/chrome/browser/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.cc b/chrome/browser/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a8224299cf23988e567b9794199c1d1c665196ce
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.cc
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/extensions/active_tab_permission_granter_delegate_chromeos.h"
+
+#include "chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.h"
+#include "chrome/browser/chromeos/extensions/public_session_permission_helper.h"
+#include "chrome/browser/profiles/profiles_state.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/permissions/api_permission.h"
+
+namespace extensions {
+
+ActiveTabPermissionGranterDelegateChromeOS::
+ ActiveTabPermissionGranterDelegateChromeOS() {}
+
+ActiveTabPermissionGranterDelegateChromeOS::
+ ~ActiveTabPermissionGranterDelegateChromeOS() {}
+
+bool ActiveTabPermissionGranterDelegateChromeOS::ActiveTabPermissionGranted(
+ const Extension* extension,
+ content::WebContents* web_contents) {
+ if (!profiles::IsPublicSession() ||
Devlin 2017/05/12 14:56:45 Do we set the delegate if it's not a public sessio
Ivan Šandrk 2017/05/12 18:27:44 Nope. I guess I'm the kind of person that likes re
Devlin 2017/05/15 20:51:12 We should be careful with redundancy when it means
+ chromeos::DeviceLocalAccountManagementPolicyProvider::IsWhitelisted(
Devlin 2017/05/12 14:56:45 Would it make sense to put this check in the permi
Ivan Šandrk 2017/05/12 18:27:44 Whitelisted extensions should have unlimited acces
+ extension->id())) {
+ return true;
+ }
+
+ bool already_handled = permission_helper::HandlePermissionRequest(
+ *extension, {APIPermission::kActiveTab}, web_contents,
+ permission_helper::RequestResolvedCallback(),
+ permission_helper::PromptFactory());
+
+ if (already_handled) {
+ return permission_helper::PermissionAllowed(
+ extension, APIPermission::kActiveTab);
+ }
+
+ return false;
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698