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

Side by Side Diff: chrome/browser/renderer_host/plugin_info_message_filter.cc

Issue 11066043: Block NPAPI plug-ins in Metro mode instead of not loading them at all. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugins/plugin_observer.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/plugin_info_message_filter.h" 5 #include "chrome/browser/renderer_host/plugin_info_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/content_settings/content_settings_utils.h" 11 #include "chrome/browser/content_settings/content_settings_utils.h"
12 #include "chrome/browser/content_settings/host_content_settings_map.h" 12 #include "chrome/browser/content_settings/host_content_settings_map.h"
13 #include "chrome/browser/plugins/plugin_finder.h" 13 #include "chrome/browser/plugins/plugin_finder.h"
14 #include "chrome/browser/plugins/plugin_metadata.h" 14 #include "chrome/browser/plugins/plugin_metadata.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_content_client.h" 17 #include "chrome/common/chrome_content_client.h"
18 #include "chrome/common/content_settings.h" 18 #include "chrome/common/content_settings.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/render_messages.h" 20 #include "chrome/common/render_messages.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/plugin_service.h" 22 #include "content/public/browser/plugin_service.h"
23 #include "content/public/browser/plugin_service_filter.h" 23 #include "content/public/browser/plugin_service_filter.h"
24 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
25 #include "webkit/plugins/npapi/plugin_list.h" 25 #include "webkit/plugins/npapi/plugin_list.h"
26 26
27 #if defined(OS_WIN)
28 #include "base/win/metro.h"
29 #endif
30
27 using content::PluginService; 31 using content::PluginService;
28 using webkit::WebPluginInfo; 32 using webkit::WebPluginInfo;
29 33
30 PluginInfoMessageFilter::Context::Context(int render_process_id, 34 PluginInfoMessageFilter::Context::Context(int render_process_id,
31 Profile* profile) 35 Profile* profile)
32 : render_process_id_(render_process_id), 36 : render_process_id_(render_process_id),
33 resource_context_(profile->GetResourceContext()), 37 resource_context_(profile->GetResourceContext()),
34 host_content_settings_map_(profile->GetHostContentSettingsMap()) { 38 host_content_settings_map_(profile->GetHostContentSettingsMap()) {
35 allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated, 39 allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
36 profile->GetPrefs(), NULL); 40 profile->GetPrefs(), NULL);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 134
131 ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output); 135 ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output);
132 Send(reply_msg); 136 Send(reply_msg);
133 } 137 }
134 138
135 void PluginInfoMessageFilter::Context::DecidePluginStatus( 139 void PluginInfoMessageFilter::Context::DecidePluginStatus(
136 const GetPluginInfo_Params& params, 140 const GetPluginInfo_Params& params,
137 const WebPluginInfo& plugin, 141 const WebPluginInfo& plugin,
138 const PluginMetadata* plugin_metadata, 142 const PluginMetadata* plugin_metadata,
139 ChromeViewHostMsg_GetPluginInfo_Status* status) const { 143 ChromeViewHostMsg_GetPluginInfo_Status* status) const {
144 #if defined(OS_WIN)
145 if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI &&
146 base::win::IsMetroProcess()) {
147 status->value =
148 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
149 return;
150 }
151 #endif
152
140 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; 153 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
141 bool uses_default_content_setting = true; 154 bool uses_default_content_setting = true;
142 // Check plug-in content settings. The primary URL is the top origin URL and 155 // Check plug-in content settings. The primary URL is the top origin URL and
143 // the secondary URL is the plug-in URL. 156 // the secondary URL is the plug-in URL.
144 GetPluginContentSetting(plugin, params.top_origin_url, params.url, 157 GetPluginContentSetting(plugin, params.top_origin_url, params.url,
145 plugin_metadata->identifier(), &plugin_setting, 158 plugin_metadata->identifier(), &plugin_setting,
146 &uses_default_content_setting); 159 &uses_default_content_setting);
147 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 160 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
148 161
149 #if defined(ENABLE_PLUGIN_INSTALLATION) 162 #if defined(ENABLE_PLUGIN_INSTALLATION)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), 282 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(),
270 &info)); 283 &info));
271 } 284 }
272 } 285 }
273 *setting = content_settings::ValueToContentSetting(value.get()); 286 *setting = content_settings::ValueToContentSetting(value.get());
274 *uses_default_content_setting = 287 *uses_default_content_setting =
275 !uses_plugin_specific_setting && 288 !uses_plugin_specific_setting &&
276 info.primary_pattern == ContentSettingsPattern::Wildcard() && 289 info.primary_pattern == ContentSettingsPattern::Wildcard() &&
277 info.secondary_pattern == ContentSettingsPattern::Wildcard(); 290 info.secondary_pattern == ContentSettingsPattern::Wildcard();
278 } 291 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_observer.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698