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

Unified Diff: chrome/renderer/content_settings_observer.cc

Issue 913253002: Fix clipboard permission callbacks to account for default values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix another test Created 5 years, 10 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 | « chrome/browser/extensions/extension_dom_clipboard_apitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/content_settings_observer.cc
diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc
index 55d961be2e406972ed55bb6bb5034729ef45a744..22c9ec21d0787d001deb459055c5b10a33c678c8 100644
--- a/chrome/renderer/content_settings_observer.cc
+++ b/chrome/renderer/content_settings_observer.cc
@@ -420,12 +420,12 @@ bool ContentSettingsObserver::allowStorage(bool local) {
}
bool ContentSettingsObserver::allowReadFromClipboard(bool default_value) {
- bool allowed = false;
+ bool allowed = default_value;
#if defined(ENABLE_EXTENSIONS)
extensions::ScriptContext* calling_context =
extension_dispatcher_->script_context_set().GetCalling();
if (calling_context) {
- allowed = calling_context->HasAPIPermission(
+ allowed |= calling_context->HasAPIPermission(
extensions::APIPermission::kClipboardRead);
}
#endif
@@ -433,7 +433,7 @@ bool ContentSettingsObserver::allowReadFromClipboard(bool default_value) {
}
bool ContentSettingsObserver::allowWriteToClipboard(bool default_value) {
- bool allowed = false;
+ bool allowed = default_value;
#if defined(ENABLE_EXTENSIONS)
// All blessed extension pages could historically write to the clipboard, so
// preserve that for compatibility.
@@ -444,7 +444,7 @@ bool ContentSettingsObserver::allowWriteToClipboard(bool default_value) {
extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
allowed = true;
} else {
- allowed = calling_context->HasAPIPermission(
+ allowed |= calling_context->HasAPIPermission(
extensions::APIPermission::kClipboardWrite);
}
}
« no previous file with comments | « chrome/browser/extensions/extension_dom_clipboard_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698