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

Unified Diff: chrome/browser/plugins/flash_permission_context.cc

Issue 2391743005: Make the flash permission prompt work properly on file: URLs (Closed)
Patch Set: test prompt Created 4 years, 2 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/plugins/flash_permission_context.h ('k') | chrome/test/data/permissions/flash.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/flash_permission_context.cc
diff --git a/chrome/browser/plugins/flash_permission_context.cc b/chrome/browser/plugins/flash_permission_context.cc
index 633f159cd8ab239287ea3efb198991f72d1ef877..bb782a621a22d9bcc0f26811c8e46b7f3ff71df6 100644
--- a/chrome/browser/plugins/flash_permission_context.cc
+++ b/chrome/browser/plugins/flash_permission_context.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/plugins/plugins_field_trial.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
@@ -46,6 +47,28 @@ void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id,
web_contents->GetController().Reload(true /* check_for_repost */);
}
+void FlashPermissionContext::UpdateContentSetting(
+ const GURL& requesting_origin,
+ const GURL& embedding_origin,
+ ContentSetting content_setting) {
+ DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
+ DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
+ DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
+ content_setting == CONTENT_SETTING_BLOCK);
+
+ // If the request was for a file scheme, allow or deny all file:/// URLs.
+ ContentSettingsPattern pattern;
+ if (embedding_origin.SchemeIsFile())
+ pattern = ContentSettingsPattern::FromString("file:///*");
+ else
+ pattern = ContentSettingsPattern::FromURLNoWildcard(embedding_origin);
+
+ HostContentSettingsMapFactory::GetForProfile(profile())
+ ->SetContentSettingCustomScope(
+ pattern, ContentSettingsPattern::Wildcard(), content_settings_type(),
+ std::string(), content_setting);
+}
+
bool FlashPermissionContext::IsRestrictedToSecureOrigins() const {
return false;
}
« no previous file with comments | « chrome/browser/plugins/flash_permission_context.h ('k') | chrome/test/data/permissions/flash.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698