OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 // TODO(avi): remove when conversions not needed any more | |
11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
12 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
13 #include "chrome/common/content_settings_helper.h" | 12 #include "chrome/common/content_settings_helper.h" |
14 #include "chrome/common/content_settings_types.h" | 13 #include "chrome/common/content_settings_types.h" |
15 #include "chrome/common/notification_service.h" | 14 #include "chrome/common/notification_service.h" |
16 #include "chrome/common/notification_type.h" | 15 #include "chrome/common/notification_type.h" |
17 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
18 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
19 | 18 |
20 struct NotificationExceptionsTableModel::Entry { | 19 struct NotificationExceptionsTableModel::Entry { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 std::wstring NotificationExceptionsTableModel::GetText(int row, | 74 std::wstring NotificationExceptionsTableModel::GetText(int row, |
76 int column_id) { | 75 int column_id) { |
77 const Entry& entry = entries_[row]; | 76 const Entry& entry = entries_[row]; |
78 if (column_id == IDS_EXCEPTIONS_HOSTNAME_HEADER) { | 77 if (column_id == IDS_EXCEPTIONS_HOSTNAME_HEADER) { |
79 return content_settings_helper::OriginToWString(entry.origin); | 78 return content_settings_helper::OriginToWString(entry.origin); |
80 } | 79 } |
81 | 80 |
82 if (column_id == IDS_EXCEPTIONS_ACTION_HEADER) { | 81 if (column_id == IDS_EXCEPTIONS_ACTION_HEADER) { |
83 switch (entry.setting) { | 82 switch (entry.setting) { |
84 case CONTENT_SETTING_ALLOW: | 83 case CONTENT_SETTING_ALLOW: |
85 return UTF16ToWideHack( | 84 return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON); |
86 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON)); | |
87 case CONTENT_SETTING_BLOCK: | 85 case CONTENT_SETTING_BLOCK: |
88 return UTF16ToWideHack( | 86 return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON); |
89 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON)); | |
90 default: | 87 default: |
91 break; | 88 break; |
92 } | 89 } |
93 } | 90 } |
94 | 91 |
95 NOTREACHED(); | 92 NOTREACHED(); |
96 return std::wstring(); | 93 return std::wstring(); |
97 } | 94 } |
98 | 95 |
99 void NotificationExceptionsTableModel::SetObserver( | 96 void NotificationExceptionsTableModel::SetObserver( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ContentSetting in_setting) | 128 ContentSetting in_setting) |
132 : origin(in_origin), | 129 : origin(in_origin), |
133 setting(in_setting) { | 130 setting(in_setting) { |
134 } | 131 } |
135 | 132 |
136 bool NotificationExceptionsTableModel::Entry::operator<( | 133 bool NotificationExceptionsTableModel::Entry::operator<( |
137 const NotificationExceptionsTableModel::Entry& b) const { | 134 const NotificationExceptionsTableModel::Entry& b) const { |
138 DCHECK_NE(origin, b.origin); | 135 DCHECK_NE(origin, b.origin); |
139 return origin < b.origin; | 136 return origin < b.origin; |
140 } | 137 } |
OLD | NEW |