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

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

Issue 5154009: Cleanup AdjustStringForLocaleDirection() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: further fixes Created 10 years, 1 month 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/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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 std::wstring TemplateURLTableModel::GetText(int row, int col_id) { 180 std::wstring TemplateURLTableModel::GetText(int row, int col_id) {
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 &url_short_name);
192 return (template_url_model_->GetDefaultSearchProvider() == &url) ? 191 return (template_url_model_->GetDefaultSearchProvider() == &url) ?
193 l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE, 192 l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE,
194 url_short_name) : url_short_name; 193 url_short_name) : url_short_name;
195 } 194 }
196 195
197 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: { 196 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: {
198 // Keyword should be domain name. Force it to have LTR directionality. 197 // Keyword should be domain name. Force it to have LTR directionality.
199 string16 keyword = WideToUTF16(url.keyword()); 198 string16 keyword = WideToUTF16(url.keyword());
200 keyword = base::i18n::GetDisplayStringInLTRDirectionality(keyword); 199 keyword = base::i18n::GetDisplayStringInLTRDirectionality(keyword);
201 return UTF16ToWide(keyword); 200 return UTF16ToWide(keyword);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) { 373 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) {
375 std::vector<ModelEntry*>::iterator i = 374 std::vector<ModelEntry*>::iterator i =
376 find(entries_.begin(), entries_.end(), entry); 375 find(entries_.begin(), entries_.end(), entry);
377 DCHECK(i != entries_.end()); 376 DCHECK(i != entries_.end());
378 NotifyChanged(static_cast<int>(i - entries_.begin())); 377 NotifyChanged(static_cast<int>(i - entries_.begin()));
379 } 378 }
380 379
381 void TemplateURLTableModel::OnTemplateURLModelChanged() { 380 void TemplateURLTableModel::OnTemplateURLModelChanged() {
382 Reload(); 381 Reload();
383 } 382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698