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

Side by Side Diff: chrome/browser/views/shelf_item_dialog.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
« no previous file with comments | « chrome/browser/views/password_manager_view.cc ('k') | chrome/common/l10n_util.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) 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/shelf_item_dialog.h" 5 #include "chrome/browser/views/shelf_item_dialog.h"
6 6
7 #include "base/gfx/png_decoder.h" 7 #include "base/gfx/png_decoder.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/app/locales/locale_settings.h" 9 #include "chrome/app/locales/locale_settings.h"
10 #include "chrome/app/theme/theme_resources.h" 10 #include "chrome/app/theme/theme_resources.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 return results_[row].title; 125 return results_[row].title;
126 } 126 }
127 127
128 virtual std::wstring GetText(int row, int col_id) { 128 virtual std::wstring GetText(int row, int col_id) {
129 if (row < 0 || row >= RowCount()) { 129 if (row < 0 || row >= RowCount()) {
130 NOTREACHED(); 130 NOTREACHED();
131 return std::wstring(); 131 return std::wstring();
132 } 132 }
133 133
134 if (col_id == IDS_ASI_PAGE_COLUMN) 134 if (col_id == IDS_ASI_PAGE_COLUMN) {
135 return GetTitle(row); 135 const std::wstring& title = GetTitle(row);
136 // TODO(xji): Consider adding a special case if the title text is a URL,
137 // since those should always have LTR directionality. Please refer to
138 // http://crbug.com/6726 for more information.
139 std::wstring localized_title;
140 if (l10n_util::AdjustStringForLocaleDirection(title, &localized_title))
141 return localized_title;
142 return title;
143 }
136 144
137 // TODO(brettw): this should probably pass the GURL up so the URL elider 145 // TODO(brettw): this should probably pass the GURL up so the URL elider
138 // can be used at a higher level when we know the width. 146 // can be used at a higher level when we know the width.
139 return results_[row].display_url.display_url(); 147 const std::wstring& url = results_[row].display_url.display_url();
148 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT)
149 return url;
150 // Force URL to be LTR.
151 std::wstring localized_url = url;
152 l10n_util::WrapStringWithLTRFormatting(&localized_url);
153 return localized_url;
140 } 154 }
141 155
142 virtual SkBitmap GetIcon(int row) { 156 virtual SkBitmap GetIcon(int row) {
143 if (row < 0 || row >= RowCount()) { 157 if (row < 0 || row >= RowCount()) {
144 NOTREACHED(); 158 NOTREACHED();
145 return *default_fav_icon; 159 return *default_fav_icon;
146 } 160 }
147 161
148 Result& result = results_[row]; 162 Result& result = results_[row];
149 FavIconMap::iterator i = fav_icon_map_.find(result.index); 163 FavIconMap::iterator i = fav_icon_map_.find(result.index);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 PerformModelChange(); 509 PerformModelChange();
496 if (window()) 510 if (window())
497 window()->Close(); 511 window()->Close();
498 } 512 }
499 } 513 }
500 514
501 GURL ShelfItemDialog::GetInputURL() const { 515 GURL ShelfItemDialog::GetInputURL() const {
502 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L"")); 516 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L""));
503 } 517 }
504 518
OLDNEW
« no previous file with comments | « chrome/browser/views/password_manager_view.cc ('k') | chrome/common/l10n_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698