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

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

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

Powered by Google App Engine
This is Rietveld 408576698