OLD | NEW |
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/chrome_plugin_service_filter.h" | 5 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/plugins/plugin_metadata.h" | 9 #include "chrome/browser/plugins/plugin_metadata.h" |
10 #include "chrome/browser/plugins/plugin_prefs.h" | 10 #include "chrome/browser/plugins/plugin_prefs.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 std::make_pair(PluginPrefs::GetForProfile(profile), | 62 std::make_pair(PluginPrefs::GetForProfile(profile), |
63 origin); | 63 origin); |
64 } | 64 } |
65 | 65 |
66 void ChromePluginServiceFilter::UnrestrictPlugin( | 66 void ChromePluginServiceFilter::UnrestrictPlugin( |
67 const FilePath& plugin_path) { | 67 const FilePath& plugin_path) { |
68 base::AutoLock auto_lock(lock_); | 68 base::AutoLock auto_lock(lock_); |
69 restricted_plugins_.erase(plugin_path); | 69 restricted_plugins_.erase(plugin_path); |
70 } | 70 } |
71 | 71 |
72 bool ChromePluginServiceFilter::IsPluginEnabled( | 72 bool ChromePluginServiceFilter::IsPluginAvailable( |
73 int render_process_id, | 73 int render_process_id, |
74 int render_view_id, | 74 int render_view_id, |
75 const void* context, | 75 const void* context, |
76 const GURL& url, | 76 const GURL& url, |
77 const GURL& policy_url, | 77 const GURL& policy_url, |
78 webkit::WebPluginInfo* plugin) { | 78 webkit::WebPluginInfo* plugin) { |
79 base::AutoLock auto_lock(lock_); | 79 base::AutoLock auto_lock(lock_); |
80 const ProcessDetails* details = GetProcess(render_process_id); | 80 const ProcessDetails* details = GetProcess(render_process_id); |
81 | 81 |
82 // Check whether the plugin is overridden. | 82 // Check whether the plugin is overridden. |
83 if (details) { | 83 if (details) { |
84 for (size_t i = 0; i < details->overridden_plugins.size(); ++i) { | 84 for (size_t i = 0; i < details->overridden_plugins.size(); ++i) { |
85 if (details->overridden_plugins[i].render_view_id == render_view_id && | 85 if (details->overridden_plugins[i].render_view_id == render_view_id && |
86 (details->overridden_plugins[i].url == url || | 86 (details->overridden_plugins[i].url == url || |
87 details->overridden_plugins[i].url.is_empty())) { | 87 details->overridden_plugins[i].url.is_empty())) { |
88 | 88 |
89 bool use = details->overridden_plugins[i].plugin.path == plugin->path; | 89 bool use = details->overridden_plugins[i].plugin.path == plugin->path; |
90 if (!use) | 90 if (use) |
91 return false; | 91 *plugin = details->overridden_plugins[i].plugin; |
92 *plugin = details->overridden_plugins[i].plugin; | 92 return use; |
93 break; | |
94 } | 93 } |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
98 // Check whether the plugin is disabled. | 97 // Check whether the plugin is disabled. |
99 ResourceContextMap::iterator prefs_it = | 98 ResourceContextMap::iterator prefs_it = |
100 resource_context_map_.find(context); | 99 resource_context_map_.find(context); |
101 if (prefs_it == resource_context_map_.end()) | 100 if (prefs_it == resource_context_map_.end()) |
102 return false; | 101 return false; |
103 | 102 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 217 |
219 ChromePluginServiceFilter::OverriddenPlugin::~OverriddenPlugin() { | 218 ChromePluginServiceFilter::OverriddenPlugin::~OverriddenPlugin() { |
220 } | 219 } |
221 | 220 |
222 ChromePluginServiceFilter::ProcessDetails::ProcessDetails() { | 221 ChromePluginServiceFilter::ProcessDetails::ProcessDetails() { |
223 } | 222 } |
224 | 223 |
225 ChromePluginServiceFilter::ProcessDetails::~ProcessDetails() { | 224 ChromePluginServiceFilter::ProcessDetails::~ProcessDetails() { |
226 } | 225 } |
227 | 226 |
OLD | NEW |