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

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

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 3 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_exceptions_table_model.h" 5 #include "chrome/browser/plugin_exceptions_table_model.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
11 #include "content/browser/plugin_service.h"
11 #include "content/common/notification_service.h" 12 #include "content/common/notification_service.h"
12 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/models/table_model_observer.h" 15 #include "ui/base/models/table_model_observer.h"
16 #include "webkit/plugins/npapi/plugin_group.h"
17 #include "webkit/plugins/webplugininfo.h"
15 18
16 PluginExceptionsTableModel::PluginExceptionsTableModel( 19 PluginExceptionsTableModel::PluginExceptionsTableModel(
17 HostContentSettingsMap* content_settings_map, 20 HostContentSettingsMap* content_settings_map,
18 HostContentSettingsMap* otr_content_settings_map) 21 HostContentSettingsMap* otr_content_settings_map)
19 : map_(content_settings_map), 22 : map_(content_settings_map),
20 otr_map_(otr_content_settings_map), 23 otr_map_(otr_content_settings_map),
21 updates_disabled_(false), 24 updates_disabled_(false),
22 observer_(NULL) { 25 observer_(NULL) {
23 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, 26 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
24 Source<HostContentSettingsMap>(map_)); 27 Source<HostContentSettingsMap>(map_));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 135
133 void PluginExceptionsTableModel::ClearSettings() { 136 void PluginExceptionsTableModel::ClearSettings() {
134 settings_.clear(); 137 settings_.clear();
135 groups_.clear(); 138 groups_.clear();
136 row_counts_.clear(); 139 row_counts_.clear();
137 resources_.clear(); 140 resources_.clear();
138 } 141 }
139 142
140 void PluginExceptionsTableModel::GetPlugins( 143 void PluginExceptionsTableModel::GetPlugins(
141 std::vector<webkit::npapi::PluginGroup>* plugin_groups) { 144 std::vector<webkit::npapi::PluginGroup>* plugin_groups) {
142 webkit::npapi::PluginList::Singleton()->GetPluginGroups(false, plugin_groups); 145 PluginService::GetInstance()->GetCachedPluginGroups(plugin_groups);
143 } 146 }
144 147
145 void PluginExceptionsTableModel::LoadSettings() { 148 void PluginExceptionsTableModel::LoadSettings() {
146 int group_id = 0; 149 int group_id = 0;
147 std::vector<webkit::npapi::PluginGroup> plugins; 150 std::vector<webkit::npapi::PluginGroup> plugins;
148 GetPlugins(&plugins); 151 GetPlugins(&plugins);
149 for (size_t i = 0; i < plugins.size(); ++i) { 152 for (size_t i = 0; i < plugins.size(); ++i) {
150 std::string plugin = plugins[i].identifier(); 153 std::string plugin = plugins[i].identifier();
151 HostContentSettingsMap::SettingsForOneType settings; 154 HostContentSettingsMap::SettingsForOneType settings;
152 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, 155 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 194 }
192 } 195 }
193 196
194 void PluginExceptionsTableModel::ReloadSettings() { 197 void PluginExceptionsTableModel::ReloadSettings() {
195 ClearSettings(); 198 ClearSettings();
196 LoadSettings(); 199 LoadSettings();
197 200
198 if (observer_) 201 if (observer_)
199 observer_->OnModelChanged(); 202 observer_->OnModelChanged();
200 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698