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

Side by Side Diff: chrome/browser/search_engines/template_url_table_model.cc

Issue 5989012: Revert 70281 - Revert 70271 - Remove wstring from l10n_util. Part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/remoting/setup_flow.cc ('k') | chrome/browser/ssl/ssl_manager.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) 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/search_engines/template_url_table_model.h" 5 #include "chrome/browser/search_engines/template_url_table_model.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 DCHECK(row >= 0 && row < RowCount()); 181 DCHECK(row >= 0 && row < RowCount());
182 const TemplateURL& url = entries_[row]->template_url(); 182 const TemplateURL& url = entries_[row]->template_url();
183 183
184 switch (col_id) { 184 switch (col_id) {
185 case IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN: { 185 case IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN: {
186 std::wstring url_short_name = url.short_name(); 186 std::wstring url_short_name = url.short_name();
187 // TODO(xji): Consider adding a special case if the short name is a URL, 187 // TODO(xji): Consider adding a special case if the short name is a URL,
188 // since those should always be displayed LTR. Please refer to 188 // since those should always be displayed LTR. Please refer to
189 // http://crbug.com/6726 for more information. 189 // http://crbug.com/6726 for more information.
190 base::i18n::AdjustStringForLocaleDirection(&url_short_name); 190 base::i18n::AdjustStringForLocaleDirection(&url_short_name);
191 return (template_url_model_->GetDefaultSearchProvider() == &url) ? 191 if (template_url_model_->GetDefaultSearchProvider() == &url) {
192 l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE, 192 return UTF16ToWideHack(
193 url_short_name) : url_short_name; 193 l10n_util::GetStringFUTF16(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE,
194 WideToUTF16Hack(url_short_name)));
195 }
196 return url_short_name;
194 } 197 }
195 198
196 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: { 199 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: {
197 // Keyword should be domain name. Force it to have LTR directionality. 200 // Keyword should be domain name. Force it to have LTR directionality.
198 string16 keyword = WideToUTF16(url.keyword()); 201 string16 keyword = WideToUTF16(url.keyword());
199 keyword = base::i18n::GetDisplayStringInLTRDirectionality(keyword); 202 keyword = base::i18n::GetDisplayStringInLTRDirectionality(keyword);
200 return UTF16ToWide(keyword); 203 return UTF16ToWide(keyword);
201 } 204 }
202 205
203 default: 206 default:
(...skipping 12 matching lines...) Expand all
216 } 219 }
217 220
218 bool TemplateURLTableModel::HasGroups() { 221 bool TemplateURLTableModel::HasGroups() {
219 return true; 222 return true;
220 } 223 }
221 224
222 TemplateURLTableModel::Groups TemplateURLTableModel::GetGroups() { 225 TemplateURLTableModel::Groups TemplateURLTableModel::GetGroups() {
223 Groups groups; 226 Groups groups;
224 227
225 Group search_engine_group; 228 Group search_engine_group;
226 search_engine_group.title = 229 search_engine_group.title = UTF16ToWideHack(
227 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAIN_SEPARATOR); 230 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_MAIN_SEPARATOR));
228 search_engine_group.id = kMainGroupID; 231 search_engine_group.id = kMainGroupID;
229 groups.push_back(search_engine_group); 232 groups.push_back(search_engine_group);
230 233
231 Group other_group; 234 Group other_group;
232 other_group.title = 235 other_group.title = UTF16ToWideHack(
233 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_OTHER_SEPARATOR); 236 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_OTHER_SEPARATOR));
234 other_group.id = kOtherGroupID; 237 other_group.id = kOtherGroupID;
235 groups.push_back(other_group); 238 groups.push_back(other_group);
236 239
237 return groups; 240 return groups;
238 } 241 }
239 242
240 int TemplateURLTableModel::GetGroupID(int row) { 243 int TemplateURLTableModel::GetGroupID(int row) {
241 DCHECK(row >= 0 && row < RowCount()); 244 DCHECK(row >= 0 && row < RowCount());
242 return row < last_search_engine_index_ ? kMainGroupID : kOtherGroupID; 245 return row < last_search_engine_index_ ? kMainGroupID : kOtherGroupID;
243 } 246 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) { 376 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) {
374 std::vector<ModelEntry*>::iterator i = 377 std::vector<ModelEntry*>::iterator i =
375 find(entries_.begin(), entries_.end(), entry); 378 find(entries_.begin(), entries_.end(), entry);
376 DCHECK(i != entries_.end()); 379 DCHECK(i != entries_.end());
377 NotifyChanged(static_cast<int>(i - entries_.begin())); 380 NotifyChanged(static_cast<int>(i - entries_.begin()));
378 } 381 }
379 382
380 void TemplateURLTableModel::OnTemplateURLModelChanged() { 383 void TemplateURLTableModel::OnTemplateURLModelChanged() {
381 Reload(); 384 Reload();
382 } 385 }
OLDNEW
« no previous file with comments | « chrome/browser/remoting/setup_flow.cc ('k') | chrome/browser/ssl/ssl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698