| 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::IsPluginAvailable( | 72 bool ChromePluginServiceFilter::IsPluginEnabled( |
| 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 *plugin = details->overridden_plugins[i].plugin; | 91 return false; |
| 92 return use; | 92 *plugin = details->overridden_plugins[i].plugin; |
| 93 break; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 | 97 |
| 97 // Check whether the plugin is disabled. | 98 // Check whether the plugin is disabled. |
| 98 ResourceContextMap::iterator prefs_it = | 99 ResourceContextMap::iterator prefs_it = |
| 99 resource_context_map_.find(context); | 100 resource_context_map_.find(context); |
| 100 if (prefs_it == resource_context_map_.end()) | 101 if (prefs_it == resource_context_map_.end()) |
| 101 return false; | 102 return false; |
| 102 | 103 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 ChromePluginServiceFilter::OverriddenPlugin::~OverriddenPlugin() { | 219 ChromePluginServiceFilter::OverriddenPlugin::~OverriddenPlugin() { |
| 219 } | 220 } |
| 220 | 221 |
| 221 ChromePluginServiceFilter::ProcessDetails::ProcessDetails() { | 222 ChromePluginServiceFilter::ProcessDetails::ProcessDetails() { |
| 222 } | 223 } |
| 223 | 224 |
| 224 ChromePluginServiceFilter::ProcessDetails::~ProcessDetails() { | 225 ChromePluginServiceFilter::ProcessDetails::~ProcessDetails() { |
| 225 } | 226 } |
| 226 | 227 |
| OLD | NEW |