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

Side by Side Diff: chrome/browser/possible_url_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/possible_url_model.h" 5 #include "chrome/browser/possible_url_model.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "app/table_model_observer.h" 8 #include "app/table_model_observer.h"
9 #include "app/text_elider.h" 9 #include "app/text_elider.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const std::wstring& title = GetTitle(row); 135 const std::wstring& title = GetTitle(row);
136 // TODO(xji): Consider adding a special case if the title text is a URL, 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 137 // since those should always have LTR directionality. Please refer to
138 // http://crbug.com/6726 for more information. 138 // http://crbug.com/6726 for more information.
139 std::wstring localized_title; 139 std::wstring localized_title = title;
Avi (use Gerrit) 2010/11/23 16:07:08 You're making a copy anyway; clearer to just make
140 if (base::i18n::AdjustStringForLocaleDirection(title, &localized_title)) 140 base::i18n::AdjustStringForLocaleDirection(&localized_title);
141 return localized_title; 141 return localized_title;
142 return title;
143 } 142 }
144 143
145 // TODO(brettw): this should probably pass the GURL up so the URL elider 144 // TODO(brettw): this should probably pass the GURL up so the URL elider
146 // can be used at a higher level when we know the width. 145 // can be used at a higher level when we know the width.
147 string16 url = results_[row].display_url.display_url(); 146 string16 url = results_[row].display_url.display_url();
148 return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(url)); 147 return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(url));
149 } 148 }
150 149
151 SkBitmap PossibleURLModel::GetIcon(int row) { 150 SkBitmap PossibleURLModel::GetIcon(int row) {
152 if (row < 0 || row >= RowCount()) { 151 if (row < 0 || row >= RowCount()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Notify the observer. 202 // Notify the observer.
204 if (!fav_icon_map_[index].isNull() && observer_) 203 if (!fav_icon_map_[index].isNull() && observer_)
205 observer_->OnItemsChanged(static_cast<int>(index), 1); 204 observer_->OnItemsChanged(static_cast<int>(index), 1);
206 } 205 }
207 } 206 }
208 } 207 }
209 208
210 void PossibleURLModel::SetObserver(TableModelObserver* observer) { 209 void PossibleURLModel::SetObserver(TableModelObserver* observer) {
211 observer_ = observer; 210 observer_ = observer;
212 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698