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

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

Issue 8071013: Finish moving plugin probing out of process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/plugin_prefs.h" 5 #include "chrome/browser/plugin_prefs.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/profiles/profile_dependency_manager.h" 24 #include "chrome/browser/profiles/profile_dependency_manager.h"
25 #include "chrome/browser/profiles/profile_keyed_service.h" 25 #include "chrome/browser/profiles/profile_keyed_service.h"
26 #include "chrome/browser/profiles/profile_keyed_service_factory.h" 26 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
27 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
28 #include "chrome/common/chrome_content_client.h" 28 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "content/browser/browser_thread.h" 33 #include "content/browser/browser_thread.h"
34 #include "content/browser/plugin_service.h"
34 #include "content/common/notification_service.h" 35 #include "content/common/notification_service.h"
35 #include "webkit/plugins/npapi/plugin_group.h" 36 #include "webkit/plugins/npapi/plugin_group.h"
36 #include "webkit/plugins/npapi/plugin_list.h" 37 #include "webkit/plugins/npapi/plugin_list.h"
37 #include "webkit/plugins/webplugininfo.h" 38 #include "webkit/plugins/webplugininfo.h"
38 39
39 namespace { 40 namespace {
40 41
41 class PluginPrefsWrapper : public ProfileKeyedService { 42 class PluginPrefsWrapper : public ProfileKeyedService {
42 public: 43 public:
43 explicit PluginPrefsWrapper(scoped_refptr<PluginPrefs> plugin_prefs) 44 explicit PluginPrefsWrapper(scoped_refptr<PluginPrefs> plugin_prefs)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 149 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
149 base::Bind(&PluginPrefs::OnUpdatePreferences, this, groups)); 150 base::Bind(&PluginPrefs::OnUpdatePreferences, this, groups));
150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 151 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
151 base::Bind(&PluginPrefs::NotifyPluginStatusChanged, this)); 152 base::Bind(&PluginPrefs::NotifyPluginStatusChanged, this));
152 } 153 }
153 154
154 bool PluginPrefs::EnablePlugin(bool enabled, const FilePath& path) { 155 bool PluginPrefs::EnablePlugin(bool enabled, const FilePath& path) {
155 // Do policy checks first. These don't need to run on the FILE thread. 156 // Do policy checks first. These don't need to run on the FILE thread.
156 webkit::npapi::PluginList* plugin_list = GetPluginList(); 157 webkit::npapi::PluginList* plugin_list = GetPluginList();
157 webkit::WebPluginInfo plugin; 158 webkit::WebPluginInfo plugin;
158 if (plugin_list->GetPluginInfoByPath(path, &plugin)) { 159 if (PluginService::GetInstance()->GetPluginInfoByPath(path, &plugin)) {
159 scoped_ptr<webkit::npapi::PluginGroup> group( 160 scoped_ptr<webkit::npapi::PluginGroup> group(
160 plugin_list->GetPluginGroup(plugin)); 161 plugin_list->GetPluginGroup(plugin));
161 PolicyStatus plugin_status = PolicyStatusForPlugin(plugin.name); 162 PolicyStatus plugin_status = PolicyStatusForPlugin(plugin.name);
162 PolicyStatus group_status = PolicyStatusForPlugin(group->GetGroupName()); 163 PolicyStatus group_status = PolicyStatusForPlugin(group->GetGroupName());
163 if (enabled) { 164 if (enabled) {
164 if (plugin_status == POLICY_DISABLED || group_status == POLICY_DISABLED) 165 if (plugin_status == POLICY_DISABLED || group_status == POLICY_DISABLED)
165 return false; 166 return false;
166 } else { 167 } else {
167 if (plugin_status == POLICY_ENABLED || group_status == POLICY_ENABLED) 168 if (plugin_status == POLICY_ENABLED || group_status == POLICY_ENABLED)
168 return false; 169 return false;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 PrefService::UNSYNCABLE_PREF); 635 PrefService::UNSYNCABLE_PREF);
635 prefs->RegisterListPref(prefs::kPluginsPluginsList, 636 prefs->RegisterListPref(prefs::kPluginsPluginsList,
636 PrefService::UNSYNCABLE_PREF); 637 PrefService::UNSYNCABLE_PREF);
637 prefs->RegisterListPref(prefs::kPluginsDisabledPlugins, 638 prefs->RegisterListPref(prefs::kPluginsDisabledPlugins,
638 PrefService::UNSYNCABLE_PREF); 639 PrefService::UNSYNCABLE_PREF);
639 prefs->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions, 640 prefs->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions,
640 PrefService::UNSYNCABLE_PREF); 641 PrefService::UNSYNCABLE_PREF);
641 prefs->RegisterListPref(prefs::kPluginsEnabledPlugins, 642 prefs->RegisterListPref(prefs::kPluginsEnabledPlugins,
642 PrefService::UNSYNCABLE_PREF); 643 PrefService::UNSYNCABLE_PREF);
643 } 644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698