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

Side by Side Diff: chrome/browser/views/keyword_editor_view.cc

Issue 18076: request review: fix issue 2821 and 6132 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/keyword_editor_view.h" 5 #include "chrome/browser/views/keyword_editor_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/gfx/png_decoder.h" 9 #include "base/gfx/png_decoder.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 int TemplateURLTableModel::RowCount() { 185 int TemplateURLTableModel::RowCount() {
186 return static_cast<int>(entries_.size()); 186 return static_cast<int>(entries_.size());
187 } 187 }
188 188
189 std::wstring TemplateURLTableModel::GetText(int row, int col_id) { 189 std::wstring TemplateURLTableModel::GetText(int row, int col_id) {
190 DCHECK(row >= 0 && row < RowCount()); 190 DCHECK(row >= 0 && row < RowCount());
191 const TemplateURL& url = entries_[row]->template_url(); 191 const TemplateURL& url = entries_[row]->template_url();
192 192
193 switch (col_id) { 193 switch (col_id) {
194 case IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN: 194 case IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN: {
195 std::wstring url_short_name = url.short_name();
196 // TODO(xji): Consider adding a special case if the short name is a URL,
197 // since those should always be displayed LTR. Please refer to
198 // http://crbug.com/6726 for more information.
199 l10n_util::AdjustStringForLocaleDirection(url_short_name,
200 &url_short_name);
195 return (template_url_model_->GetDefaultSearchProvider() == &url) ? 201 return (template_url_model_->GetDefaultSearchProvider() == &url) ?
196 l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE, 202 l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE,
197 url.short_name()) : 203 url_short_name) : url_short_name;
198 url.short_name(); 204 }
199 205
200 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: 206 case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: {
201 return url.keyword(); 207 const std::wstring& keyword = url.keyword();
208 // Keyword should be domain name. Force it to have LTR directionality.
209 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) {
210 std::wstring localized_keyword = keyword;
211 l10n_util::WrapStringWithLTRFormatting(&localized_keyword);
212 return localized_keyword;
213 }
214 return keyword;
202 break; 215 break;
216 }
203 217
204 default: 218 default:
205 NOTREACHED(); 219 NOTREACHED();
206 return std::wstring(); 220 return std::wstring();
207 } 221 }
208 } 222 }
209 223
210 SkBitmap TemplateURLTableModel::GetIcon(int row) { 224 SkBitmap TemplateURLTableModel::GetIcon(int row) {
211 DCHECK(row >= 0 && row < RowCount()); 225 DCHECK(row >= 0 && row < RowCount());
212 return entries_[row]->GetIcon(); 226 return entries_[row]->GetIcon();
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 636 }
623 const int new_index = table_model_->IndexOfTemplateURL(keyword); 637 const int new_index = table_model_->IndexOfTemplateURL(keyword);
624 table_model_->NotifyChanged(new_index); 638 table_model_->NotifyChanged(new_index);
625 639
626 // Make sure the new default is in the main group. 640 // Make sure the new default is in the main group.
627 table_model_->MoveToMainGroup(index); 641 table_model_->MoveToMainGroup(index);
628 642
629 // And select it. 643 // And select it.
630 table_view_->Select(table_model_->IndexOfTemplateURL(keyword)); 644 table_view_->Select(table_model_->IndexOfTemplateURL(keyword));
631 } 645 }
OLDNEW
« no previous file with comments | « chrome/browser/views/hung_renderer_view.cc ('k') | chrome/browser/views/options/cookies_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698