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

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

Issue 2378573005: [HBD] Blanket BLOCK on all non-HTTP(s) and non-FILE URLs for Flash. (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into 293-hbd-implement-blan… 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/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/permissions/permission_request_id.h" 9 #include "chrome/browser/permissions/permission_request_id.h"
10 #include "chrome/browser/plugins/plugin_utils.h" 10 #include "chrome/browser/plugins/plugin_utils.h"
11 #include "chrome/browser/plugins/plugins_field_trial.h" 11 #include "chrome/browser/plugins/plugins_field_trial.h"
12 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h " 12 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h "
13 #include "components/content_settings/core/browser/host_content_settings_map.h" 13 #include "components/content_settings/core/browser/host_content_settings_map.h"
14 #include "content/public/browser/render_frame_host.h" 14 #include "content/public/browser/render_frame_host.h"
15 #include "url/origin.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() {}
22 23
23 ContentSetting FlashPermissionContext::GetPermissionStatus( 24 ContentSetting FlashPermissionContext::GetPermissionStatus(
24 const GURL& requesting_origin, 25 const GURL& requesting_origin,
25 const GURL& embedding_origin) const { 26 const GURL& embedding_origin) const {
26 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( 27 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting(
27 HostContentSettingsMapFactory::GetForProfile(profile()), embedding_origin, 28 HostContentSettingsMapFactory::GetForProfile(profile()),
28 requesting_origin, nullptr); 29 url::Origin(embedding_origin), requesting_origin, nullptr);
29 flash_setting = PluginsFieldTrial::EffectiveContentSetting( 30 flash_setting = PluginsFieldTrial::EffectiveContentSetting(
30 CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); 31 CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting);
31 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) 32 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT)
32 return CONTENT_SETTING_ASK; 33 return CONTENT_SETTING_ASK;
33 return flash_setting; 34 return flash_setting;
34 } 35 }
35 36
36 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, 37 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id,
37 const GURL& requesting_origin, 38 const GURL& requesting_origin,
38 bool allowed) { 39 bool allowed) {
39 if (!allowed) 40 if (!allowed)
40 return; 41 return;
41 content::WebContents* web_contents = 42 content::WebContents* web_contents =
42 content::WebContents::FromRenderFrameHost( 43 content::WebContents::FromRenderFrameHost(
43 content::RenderFrameHost::FromID(id.render_process_id(), 44 content::RenderFrameHost::FromID(id.render_process_id(),
44 id.render_frame_id())); 45 id.render_frame_id()));
45 InfoBarService* infobar_service = 46 InfoBarService* infobar_service =
46 InfoBarService::FromWebContents(web_contents); 47 InfoBarService::FromWebContents(web_contents);
47 if (infobar_service) 48 if (infobar_service)
48 WebsiteSettingsInfoBarDelegate::Create(infobar_service); 49 WebsiteSettingsInfoBarDelegate::Create(infobar_service);
49 } 50 }
50 51
51 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { 52 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const {
52 return false; 53 return false;
53 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698