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

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

Issue 6044007: Remove wstring from TableModel.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 12 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) 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/plugin_exceptions_table_model.h" 5 #include "chrome/browser/plugin_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 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 ClearSettings(); 69 ClearSettings();
70 if (observer_) 70 if (observer_)
71 observer_->OnModelChanged(); 71 observer_->OnModelChanged();
72 } 72 }
73 73
74 int PluginExceptionsTableModel::RowCount() { 74 int PluginExceptionsTableModel::RowCount() {
75 return settings_.size(); 75 return settings_.size();
76 } 76 }
77 77
78 std::wstring PluginExceptionsTableModel::GetText(int row, int column_id) { 78 string16 PluginExceptionsTableModel::GetText(int row, int column_id) {
79 DCHECK_GE(row, 0); 79 DCHECK_GE(row, 0);
80 DCHECK_LT(row, static_cast<int>(settings_.size())); 80 DCHECK_LT(row, static_cast<int>(settings_.size()));
81 SettingsEntry& entry = settings_[row]; 81 SettingsEntry& entry = settings_[row];
82 switch (column_id) { 82 switch (column_id) {
83 case IDS_EXCEPTIONS_PATTERN_HEADER: 83 case IDS_EXCEPTIONS_PATTERN_HEADER:
84 case IDS_EXCEPTIONS_HOSTNAME_HEADER: 84 case IDS_EXCEPTIONS_HOSTNAME_HEADER:
85 return UTF8ToWide(entry.pattern.AsString()); 85 return UTF8ToUTF16(entry.pattern.AsString());
86 86
87 case IDS_EXCEPTIONS_ACTION_HEADER: 87 case IDS_EXCEPTIONS_ACTION_HEADER:
88 switch (entry.setting) { 88 switch (entry.setting) {
89 case CONTENT_SETTING_ALLOW: 89 case CONTENT_SETTING_ALLOW:
90 return UTF16ToWideHack( 90 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
91 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON));
92 case CONTENT_SETTING_BLOCK: 91 case CONTENT_SETTING_BLOCK:
93 return UTF16ToWideHack( 92 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
94 l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON));
95 default: 93 default:
96 NOTREACHED(); 94 NOTREACHED();
97 } 95 }
98 break; 96 break;
99 97
100 default: 98 default:
101 NOTREACHED(); 99 NOTREACHED();
102 } 100 }
103 101
104 return std::wstring(); 102 return string16();
105 } 103 }
106 104
107 bool PluginExceptionsTableModel::HasGroups() { 105 bool PluginExceptionsTableModel::HasGroups() {
108 return true; 106 return true;
109 } 107 }
110 108
111 void PluginExceptionsTableModel::SetObserver(TableModelObserver* observer) { 109 void PluginExceptionsTableModel::SetObserver(TableModelObserver* observer) {
112 observer_ = observer; 110 observer_ = observer;
113 } 111 }
114 112
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 HostContentSettingsMap::SettingsForOneType settings; 147 HostContentSettingsMap::SettingsForOneType settings;
150 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, 148 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS,
151 plugin, 149 plugin,
152 &settings); 150 &settings);
153 HostContentSettingsMap::SettingsForOneType otr_settings; 151 HostContentSettingsMap::SettingsForOneType otr_settings;
154 if (otr_map_) { 152 if (otr_map_) {
155 otr_map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, 153 otr_map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS,
156 plugin, 154 plugin,
157 &otr_settings); 155 &otr_settings);
158 } 156 }
159 std::wstring title = UTF16ToWide(plugins[i].GetGroupName()); 157 string16 title = plugins[i].GetGroupName();
160 for (HostContentSettingsMap::SettingsForOneType::iterator setting_it = 158 for (HostContentSettingsMap::SettingsForOneType::iterator setting_it =
161 settings.begin(); setting_it != settings.end(); ++setting_it) { 159 settings.begin(); setting_it != settings.end(); ++setting_it) {
162 SettingsEntry entry = { 160 SettingsEntry entry = {
163 setting_it->first, 161 setting_it->first,
164 group_id, 162 group_id,
165 setting_it->second, 163 setting_it->second,
166 false 164 false
167 }; 165 };
168 settings_.push_back(entry); 166 settings_.push_back(entry);
169 } 167 }
(...skipping 19 matching lines...) Expand all
189 } 187 }
190 188
191 void PluginExceptionsTableModel::ReloadSettings() { 189 void PluginExceptionsTableModel::ReloadSettings() {
192 ClearSettings(); 190 ClearSettings();
193 LoadSettings(); 191 LoadSettings();
194 192
195 if (observer_) 193 if (observer_)
196 observer_->OnModelChanged(); 194 observer_->OnModelChanged();
197 } 195 }
198 196
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698