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/content_exceptions_table_model.h" | 5 #include "chrome/browser/content_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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (entries(is_off_the_record)[i].first == pattern) | 93 if (entries(is_off_the_record)[i].first == pattern) |
94 return offset + static_cast<int>(i); | 94 return offset + static_cast<int>(i); |
95 } | 95 } |
96 return -1; | 96 return -1; |
97 } | 97 } |
98 | 98 |
99 int ContentExceptionsTableModel::RowCount() { | 99 int ContentExceptionsTableModel::RowCount() { |
100 return static_cast<int>(entries_.size() + off_the_record_entries_.size()); | 100 return static_cast<int>(entries_.size() + off_the_record_entries_.size()); |
101 } | 101 } |
102 | 102 |
103 std::wstring ContentExceptionsTableModel::GetText(int row, int column_id) { | 103 string16 ContentExceptionsTableModel::GetText(int row, int column_id) { |
104 HostContentSettingsMap::PatternSettingPair entry = entry_at(row); | 104 HostContentSettingsMap::PatternSettingPair entry = entry_at(row); |
105 | 105 |
106 switch (column_id) { | 106 switch (column_id) { |
107 case IDS_EXCEPTIONS_PATTERN_HEADER: | 107 case IDS_EXCEPTIONS_PATTERN_HEADER: |
108 return UTF8ToWide(entry.first.AsString()); | 108 return UTF8ToUTF16(entry.first.AsString()); |
109 | 109 |
110 case IDS_EXCEPTIONS_ACTION_HEADER: | 110 case IDS_EXCEPTIONS_ACTION_HEADER: |
111 switch (entry.second) { | 111 switch (entry.second) { |
112 case CONTENT_SETTING_ALLOW: | 112 case CONTENT_SETTING_ALLOW: |
113 return UTF16ToWideHack( | 113 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON); |
114 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON)); | |
115 case CONTENT_SETTING_BLOCK: | 114 case CONTENT_SETTING_BLOCK: |
116 return UTF16ToWideHack( | 115 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON); |
117 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON)); | |
118 case CONTENT_SETTING_ASK: | 116 case CONTENT_SETTING_ASK: |
119 return UTF16ToWideHack( | 117 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ASK_BUTTON); |
120 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ASK_BUTTON)); | |
121 case CONTENT_SETTING_SESSION_ONLY: | 118 case CONTENT_SETTING_SESSION_ONLY: |
122 return UTF16ToWideHack( | 119 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON); |
123 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON)); | |
124 default: | 120 default: |
125 NOTREACHED(); | 121 NOTREACHED(); |
126 } | 122 } |
127 break; | 123 break; |
128 | 124 |
129 default: | 125 default: |
130 NOTREACHED(); | 126 NOTREACHED(); |
131 } | 127 } |
132 | 128 |
133 return std::wstring(); | 129 return string16(); |
134 } | 130 } |
135 | 131 |
136 void ContentExceptionsTableModel::SetObserver(TableModelObserver* observer) { | 132 void ContentExceptionsTableModel::SetObserver(TableModelObserver* observer) { |
137 observer_ = observer; | 133 observer_ = observer; |
138 } | 134 } |
OLD | NEW |