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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « chrome/browser/plugin_exceptions_table_model.h ('k') | chrome/browser/plugin_updater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/common/notification_service.h" 11 #include "content/common/notification_service.h"
11 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/models/table_model_observer.h" 14 #include "ui/base/models/table_model_observer.h"
14 15
15 PluginExceptionsTableModel::PluginExceptionsTableModel( 16 PluginExceptionsTableModel::PluginExceptionsTableModel(
16 HostContentSettingsMap* content_settings_map, 17 HostContentSettingsMap* content_settings_map,
17 HostContentSettingsMap* otr_content_settings_map) 18 HostContentSettingsMap* otr_content_settings_map)
18 : map_(content_settings_map), 19 : map_(content_settings_map),
19 otr_map_(otr_content_settings_map), 20 otr_map_(otr_content_settings_map),
20 updates_disabled_(false), 21 updates_disabled_(false),
21 observer_(NULL) { 22 observer_(NULL) {
22 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, 23 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
23 Source<HostContentSettingsMap>(map_)); 24 Source<HostContentSettingsMap>(map_));
24 if (otr_map_) { 25 if (otr_map_) {
25 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, 26 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
26 Source<HostContentSettingsMap>(otr_map_)); 27 Source<HostContentSettingsMap>(otr_map_));
27 } 28 }
28 } 29 }
29 30
30 PluginExceptionsTableModel::~PluginExceptionsTableModel() { 31 PluginExceptionsTableModel::~PluginExceptionsTableModel() {
31 } 32 }
32 33
33 bool PluginExceptionsTableModel::CanRemoveRows(const Rows& rows) const { 34 bool PluginExceptionsTableModel::CanRemoveRows(const Rows& rows) const {
34 return !rows.empty(); 35 return !rows.empty();
35 } 36 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 ui::TableModel::Groups PluginExceptionsTableModel::GetGroups() { 117 ui::TableModel::Groups PluginExceptionsTableModel::GetGroups() {
117 return groups_; 118 return groups_;
118 } 119 }
119 120
120 int PluginExceptionsTableModel::GetGroupID(int row) { 121 int PluginExceptionsTableModel::GetGroupID(int row) {
121 DCHECK_LT(row, static_cast<int>(settings_.size())); 122 DCHECK_LT(row, static_cast<int>(settings_.size()));
122 return settings_[row].plugin_id; 123 return settings_[row].plugin_id;
123 } 124 }
124 125
125 void PluginExceptionsTableModel::Observe(NotificationType type, 126 void PluginExceptionsTableModel::Observe(int type,
126 const NotificationSource& source, 127 const NotificationSource& source,
127 const NotificationDetails& details) { 128 const NotificationDetails& details) {
128 if (!updates_disabled_) 129 if (!updates_disabled_)
129 ReloadSettings(); 130 ReloadSettings();
130 } 131 }
131 132
132 void PluginExceptionsTableModel::ClearSettings() { 133 void PluginExceptionsTableModel::ClearSettings() {
133 settings_.clear(); 134 settings_.clear();
134 groups_.clear(); 135 groups_.clear();
135 row_counts_.clear(); 136 row_counts_.clear();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 191 }
191 } 192 }
192 193
193 void PluginExceptionsTableModel::ReloadSettings() { 194 void PluginExceptionsTableModel::ReloadSettings() {
194 ClearSettings(); 195 ClearSettings();
195 LoadSettings(); 196 LoadSettings();
196 197
197 if (observer_) 198 if (observer_)
198 observer_->OnModelChanged(); 199 observer_->OnModelChanged();
199 } 200 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_exceptions_table_model.h ('k') | chrome/browser/plugin_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698