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

Side by Side Diff: chrome/browser/plugins/flash_permission_context.cc

Issue 2391743005: Make the flash permission prompt work properly on file: URLs (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/plugins/flash_permission_context.h" 5 #include "chrome/browser/plugins/flash_permission_context.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/permissions/permission_request_id.h" 8 #include "chrome/browser/permissions/permission_request_id.h"
9 #include "chrome/browser/plugins/plugin_utils.h" 9 #include "chrome/browser/plugins/plugin_utils.h"
10 #include "chrome/browser/plugins/plugins_field_trial.h" 10 #include "chrome/browser/plugins/plugins_field_trial.h"
11 #include "components/content_settings/core/browser/host_content_settings_map.h" 11 #include "components/content_settings/core/browser/host_content_settings_map.h"
12 #include "components/content_settings/core/common/content_settings_pattern.h"
12 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
13 #include "content/public/browser/render_frame_host.h" 14 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 16
16 FlashPermissionContext::FlashPermissionContext(Profile* profile) 17 FlashPermissionContext::FlashPermissionContext(Profile* profile)
17 : PermissionContextBase(profile, 18 : PermissionContextBase(profile,
18 content::PermissionType::FLASH, 19 content::PermissionType::FLASH,
19 CONTENT_SETTINGS_TYPE_PLUGINS) {} 20 CONTENT_SETTINGS_TYPE_PLUGINS) {}
20 21
21 FlashPermissionContext::~FlashPermissionContext() {} 22 FlashPermissionContext::~FlashPermissionContext() {}
(...skipping 17 matching lines...) Expand all
39 if (!allowed) 40 if (!allowed)
40 return; 41 return;
41 // Automatically refresh the page. 42 // Automatically refresh the page.
42 content::WebContents* web_contents = 43 content::WebContents* web_contents =
43 content::WebContents::FromRenderFrameHost( 44 content::WebContents::FromRenderFrameHost(
44 content::RenderFrameHost::FromID(id.render_process_id(), 45 content::RenderFrameHost::FromID(id.render_process_id(),
45 id.render_frame_id())); 46 id.render_frame_id()));
46 web_contents->GetController().Reload(true /* check_for_repost */); 47 web_contents->GetController().Reload(true /* check_for_repost */);
47 } 48 }
48 49
50 void FlashPermissionContext::UpdateContentSetting(
51 const GURL& requesting_origin,
52 const GURL& embedding_origin,
53 ContentSetting content_setting) {
54 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
55 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
56 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
57 content_setting == CONTENT_SETTING_BLOCK);
58
59 // If the request was for a file scheme, allow or deny all file:/// URLs.
60 ContentSettingsPattern pattern;
61 if (embedding_origin.SchemeIsFile())
62 pattern = ContentSettingsPattern::FromString("file:///*");
63 else
64 pattern = ContentSettingsPattern::FromURLNoWildcard(embedding_origin);
65
66 HostContentSettingsMapFactory::GetForProfile(profile())
67 ->SetContentSettingCustomScope(
68 pattern, ContentSettingsPattern::Wildcard(), content_settings_type(),
69 std::string(), content_setting);
70 }
71
49 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { 72 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const {
50 return false; 73 return false;
51 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698