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

Side by Side Diff: chrome/browser/chrome_plugin_service_filter.cc

Issue 10993016: Override plug-ins by path instead of name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 2 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/chrome_plugin_service_filter.h" 5 #include "chrome/browser/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_prefs.h" 9 #include "chrome/browser/plugins/plugin_prefs.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 26 matching lines...) Expand all
37 void ChromePluginServiceFilter::UnregisterResourceContext( 37 void ChromePluginServiceFilter::UnregisterResourceContext(
38 const void* context) { 38 const void* context) {
39 base::AutoLock lock(lock_); 39 base::AutoLock lock(lock_);
40 resource_context_map_.erase(context); 40 resource_context_map_.erase(context);
41 } 41 }
42 42
43 void ChromePluginServiceFilter::OverridePluginForTab( 43 void ChromePluginServiceFilter::OverridePluginForTab(
44 int render_process_id, 44 int render_process_id,
45 int render_view_id, 45 int render_view_id,
46 const GURL& url, 46 const GURL& url,
47 const string16& plugin_name) { 47 const webkit::WebPluginInfo& plugin) {
48 OverriddenPlugin overridden_plugin; 48 OverriddenPlugin overridden_plugin;
49 overridden_plugin.render_process_id = render_process_id; 49 overridden_plugin.render_process_id = render_process_id;
50 overridden_plugin.render_view_id = render_view_id; 50 overridden_plugin.render_view_id = render_view_id;
51 overridden_plugin.url = url; 51 overridden_plugin.url = url;
52 overridden_plugin.plugin_name = plugin_name; 52 overridden_plugin.plugin = plugin;
53 base::AutoLock auto_lock(lock_); 53 base::AutoLock auto_lock(lock_);
54 overridden_plugins_.push_back(overridden_plugin); 54 overridden_plugins_.push_back(overridden_plugin);
55 } 55 }
56 56
57 void ChromePluginServiceFilter::RestrictPluginToProfileAndOrigin( 57 void ChromePluginServiceFilter::RestrictPluginToProfileAndOrigin(
58 const FilePath& plugin_path, 58 const FilePath& plugin_path,
59 Profile* profile, 59 Profile* profile,
60 const GURL& origin) { 60 const GURL& origin) {
61 base::AutoLock auto_lock(lock_); 61 base::AutoLock auto_lock(lock_);
62 restricted_plugins_[plugin_path] = 62 restricted_plugins_[plugin_path] =
(...skipping 15 matching lines...) Expand all
78 const GURL& policy_url, 78 const GURL& policy_url,
79 webkit::WebPluginInfo* plugin) { 79 webkit::WebPluginInfo* plugin) {
80 base::AutoLock auto_lock(lock_); 80 base::AutoLock auto_lock(lock_);
81 // Check whether the plugin is overridden. 81 // Check whether the plugin is overridden.
82 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { 82 for (size_t i = 0; i < overridden_plugins_.size(); ++i) {
83 if (overridden_plugins_[i].render_process_id == render_process_id && 83 if (overridden_plugins_[i].render_process_id == render_process_id &&
84 overridden_plugins_[i].render_view_id == render_view_id && 84 overridden_plugins_[i].render_view_id == render_view_id &&
85 (overridden_plugins_[i].url == url || 85 (overridden_plugins_[i].url == url ||
86 overridden_plugins_[i].url.is_empty())) { 86 overridden_plugins_[i].url.is_empty())) {
87 87
88 bool use = overridden_plugins_[i].plugin_name == plugin->name; 88 bool use = overridden_plugins_[i].plugin.path == plugin->path;
89 if (use && 89 if (use)
90 plugin->name == ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)) { 90 *plugin = overridden_plugins_[i].plugin;
91 // If the caller is forcing the Adobe Reader plugin, then don't show the 91
92 // blocked plugin UI if it's vulnerable.
93 plugin->version = ASCIIToUTF16("11.0.0.0");
94 }
95 return use; 92 return use;
96 } 93 }
97 } 94 }
98 95
99 // Check whether the plugin is disabled. 96 // Check whether the plugin is disabled.
100 ResourceContextMap::iterator prefs_it = 97 ResourceContextMap::iterator prefs_it =
101 resource_context_map_.find(context); 98 resource_context_map_.find(context);
102 if (prefs_it == resource_context_map_.end()) 99 if (prefs_it == resource_context_map_.end())
103 return false; 100 return false;
104 101
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 PluginService::GetInstance()->PurgePluginListCache( 158 PluginService::GetInstance()->PurgePluginListCache(
162 profile->GetOffTheRecordProfile(), false); 159 profile->GetOffTheRecordProfile(), false);
163 } 160 }
164 break; 161 break;
165 } 162 }
166 default: { 163 default: {
167 NOTREACHED(); 164 NOTREACHED();
168 } 165 }
169 } 166 }
170 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_plugin_service_filter.h ('k') | chrome/browser/printing/print_preview_tab_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698