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

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

Issue 2354443002: Implement PluginsPermissionContext and hookup to flash download interception. (Closed)
Patch Set: Implement PluginsPermissionContext and hookup to flash download interception. Created 4 years, 3 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"
8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/permissions/permission_request_id.h"
10 #include "chrome/browser/plugins/plugin_utils.h"
11 #include "chrome/browser/plugins/plugins_field_trial.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"
14 #include "content/public/browser/render_frame_host.h"
15
7 FlashPermissionContext::FlashPermissionContext(Profile* profile) 16 FlashPermissionContext::FlashPermissionContext(Profile* profile)
8 : PermissionContextBase(profile, 17 : PermissionContextBase(profile,
9 content::PermissionType::FLASH, 18 content::PermissionType::FLASH,
10 CONTENT_SETTINGS_TYPE_PLUGINS) {} 19 CONTENT_SETTINGS_TYPE_PLUGINS) {}
11 20
12 FlashPermissionContext::~FlashPermissionContext() {} 21 FlashPermissionContext::~FlashPermissionContext() {}
13 22
23 ContentSetting FlashPermissionContext::GetPermissionStatus(
24 const GURL& requesting_origin,
25 const GURL& embedding_origin) const {
26 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting(
27 HostContentSettingsMapFactory::GetForProfile(profile()), embedding_origin,
28 requesting_origin);
29 flash_setting = PluginsFieldTrial::EffectiveContentSetting(
30 CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting);
31 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT)
32 return CONTENT_SETTING_ASK;
33 return flash_setting;
34 }
35
36 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id,
37 const GURL& requesting_origin,
38 bool allowed) {
39 if (allowed) {
Bernhard Bauer 2016/09/22 16:59:10 Return early if not allowed?
raymes 2016/09/26 03:23:33 Done.
40 content::WebContents* web_contents =
41 content::WebContents::FromRenderFrameHost(
42 content::RenderFrameHost::FromID(id.render_process_id(),
43 id.render_frame_id()));
44 InfoBarService* infobar_service =
45 InfoBarService::FromWebContents(web_contents);
46 if (infobar_service)
47 WebsiteSettingsInfoBarDelegate::Create(infobar_service);
48 }
49 }
50
14 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { 51 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const {
15 return false; 52 return false;
16 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698