OLD | NEW |
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/notifications/notification_exceptions_table_model.h" | 5 #include "chrome/browser/notifications/notification_exceptions_table_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 DCHECK_EQ(Source<DesktopNotificationService>(source).ptr(), service_); | 109 DCHECK_EQ(Source<DesktopNotificationService>(source).ptr(), service_); |
110 entries_.clear(); | 110 entries_.clear(); |
111 LoadEntries(); | 111 LoadEntries(); |
112 | 112 |
113 if (observer_) | 113 if (observer_) |
114 observer_->OnModelChanged(); | 114 observer_->OnModelChanged(); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 void NotificationExceptionsTableModel::LoadEntries() { | 118 void NotificationExceptionsTableModel::LoadEntries() { |
119 HostContentSettingsMap::SettingsForOneType settings; | 119 ContentSettingsForOneType settings; |
120 service_->GetNotificationsSettings(&settings); | 120 service_->GetNotificationsSettings(&settings); |
121 | 121 |
122 entries_.reserve(settings.size()); | 122 entries_.reserve(settings.size()); |
123 for (HostContentSettingsMap::SettingsForOneType::const_iterator i = | 123 for (ContentSettingsForOneType::const_iterator i = |
124 settings.begin(); | 124 settings.begin(); |
125 i != settings.end(); | 125 i != settings.end(); |
126 ++i) { | 126 ++i) { |
127 const HostContentSettingsMap::PatternSettingSourceTuple& tuple(*i); | 127 const ContentSettingPatternSourceTuple& tuple(*i); |
128 entries_.push_back(Entry(tuple.a, tuple.c)); | 128 entries_.push_back(Entry(tuple.a, tuple.c)); |
129 } | 129 } |
130 std::sort(entries_.begin(), entries_.end()); | 130 std::sort(entries_.begin(), entries_.end()); |
131 } | 131 } |
132 | 132 |
133 NotificationExceptionsTableModel::Entry::Entry( | 133 NotificationExceptionsTableModel::Entry::Entry( |
134 const ContentSettingsPattern& in_origin, | 134 const ContentSettingsPattern& in_origin, |
135 ContentSetting in_setting) | 135 ContentSetting in_setting) |
136 : origin(in_origin), | 136 : origin(in_origin), |
137 setting(in_setting) { | 137 setting(in_setting) { |
138 } | 138 } |
139 | 139 |
140 bool NotificationExceptionsTableModel::Entry::operator<( | 140 bool NotificationExceptionsTableModel::Entry::operator<( |
141 const NotificationExceptionsTableModel::Entry& b) const { | 141 const NotificationExceptionsTableModel::Entry& b) const { |
142 DCHECK_NE(origin, b.origin); | 142 DCHECK_NE(origin, b.origin); |
143 return origin.ToString() < b.origin.ToString(); | 143 return origin.ToString() < b.origin.ToString(); |
144 } | 144 } |
OLD | NEW |