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

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

Issue 12114045: Broke ContentSettingBubbleModelTest.Plugins on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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/plugins/plugin_info_message_filter.h" 5 #include "chrome/browser/plugins/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/chrome_plugin_service_filter.h"
14 #include "chrome/browser/plugins/plugin_finder.h" 13 #include "chrome/browser/plugins/plugin_finder.h"
15 #include "chrome/browser/plugins/plugin_metadata.h" 14 #include "chrome/browser/plugins/plugin_metadata.h"
16 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_content_client.h" 17 #include "chrome/common/chrome_content_client.h"
19 #include "chrome/common/content_settings.h" 18 #include "chrome/common/content_settings.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "chrome/common/render_messages.h" 20 #include "chrome/common/render_messages.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/plugin_service.h" 22 #include "content/public/browser/plugin_service.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 &plugin_metadata)) { 125 &plugin_metadata)) {
127 context_.DecidePluginStatus(params, output.plugin, plugin_metadata.get(), 126 context_.DecidePluginStatus(params, output.plugin, plugin_metadata.get(),
128 &output.status); 127 &output.status);
129 } 128 }
130 129
131 if (plugin_metadata) { 130 if (plugin_metadata) {
132 output.group_identifier = plugin_metadata->identifier(); 131 output.group_identifier = plugin_metadata->identifier();
133 output.group_name = plugin_metadata->name(); 132 output.group_name = plugin_metadata->name();
134 } 133 }
135 134
136 context_.GrantAccess(output.status, output.plugin.path);
137
138 ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output); 135 ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output);
139 Send(reply_msg); 136 Send(reply_msg);
140 } 137 }
141 138
142 void PluginInfoMessageFilter::Context::DecidePluginStatus( 139 void PluginInfoMessageFilter::Context::DecidePluginStatus(
143 const GetPluginInfo_Params& params, 140 const GetPluginInfo_Params& params,
144 const WebPluginInfo& plugin, 141 const WebPluginInfo& plugin,
145 const PluginMetadata* plugin_metadata, 142 const PluginMetadata* plugin_metadata,
146 ChromeViewHostMsg_GetPluginInfo_Status* status) const { 143 ChromeViewHostMsg_GetPluginInfo_Status* status) const {
147 #if defined(OS_WIN) 144 #if defined(OS_WIN)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 url, mime_type, allow_wildcard, &matching_plugins, &mime_types); 218 url, mime_type, allow_wildcard, &matching_plugins, &mime_types);
222 if (matching_plugins.empty()) { 219 if (matching_plugins.empty()) {
223 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; 220 status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
224 return false; 221 return false;
225 } 222 }
226 223
227 content::PluginServiceFilter* filter = 224 content::PluginServiceFilter* filter =
228 PluginService::GetInstance()->GetFilter(); 225 PluginService::GetInstance()->GetFilter();
229 size_t i = 0; 226 size_t i = 0;
230 for (; i < matching_plugins.size(); ++i) { 227 for (; i < matching_plugins.size(); ++i) {
231 if (!filter || filter->IsPluginEnabled(render_process_id_, 228 if (!filter || filter->ShouldUsePlugin(render_process_id_,
232 render_view_id, 229 render_view_id,
233 resource_context_, 230 resource_context_,
234 url, 231 url,
235 top_origin_url, 232 top_origin_url,
236 &matching_plugins[i])) { 233 &matching_plugins[i])) {
237 break; 234 break;
238 } 235 }
239 } 236 }
240 237
241 // If we broke out of the loop, we have found an enabled plug-in. 238 // If we broke out of the loop, we have found an enabled plug-in.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), 282 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(),
286 &info)); 283 &info));
287 } 284 }
288 } 285 }
289 *setting = content_settings::ValueToContentSetting(value.get()); 286 *setting = content_settings::ValueToContentSetting(value.get());
290 *uses_default_content_setting = 287 *uses_default_content_setting =
291 !uses_plugin_specific_setting && 288 !uses_plugin_specific_setting &&
292 info.primary_pattern == ContentSettingsPattern::Wildcard() && 289 info.primary_pattern == ContentSettingsPattern::Wildcard() &&
293 info.secondary_pattern == ContentSettingsPattern::Wildcard(); 290 info.secondary_pattern == ContentSettingsPattern::Wildcard();
294 } 291 }
295
296 void PluginInfoMessageFilter::Context::GrantAccess(
297 const ChromeViewHostMsg_GetPluginInfo_Status& status,
298 const FilePath& path) const {
299 if (status.value == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed ||
300 status.value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay) {
301 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin(
302 render_process_id_, path);
303 }
304 }
305
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/browser/plugins/plugin_infobar_delegates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698