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

Side by Side Diff: chrome/browser/possible_url_model.cc

Issue 6044007: Remove wstring from TableModel.... (Closed) Base URL: svn://chrome-svn/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
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 const std::wstring& PossibleURLModel::GetTitle(int row) { 120 const std::wstring& PossibleURLModel::GetTitle(int row) {
121 if (row < 0 || row >= RowCount()) { 121 if (row < 0 || row >= RowCount()) {
122 NOTREACHED(); 122 NOTREACHED();
123 return EmptyWString(); 123 return EmptyWString();
124 } 124 }
125 return results_[row].title; 125 return results_[row].title;
126 } 126 }
127 127
128 std::wstring PossibleURLModel::GetText(int row, int col_id) { 128 string16 PossibleURLModel::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 string16();
132 } 132 }
133 133
134 if (col_id == IDS_ASI_PAGE_COLUMN) { 134 if (col_id == IDS_ASI_PAGE_COLUMN) {
135 std::wstring title = GetTitle(row); 135 string16 title = WideToUTF16Hack(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 base::i18n::AdjustStringForLocaleDirection(&title); 139 base::i18n::AdjustStringForLocaleDirection(&title);
140 return title; 140 return title;
141 } 141 }
142 142
143 // TODO(brettw): this should probably pass the GURL up so the URL elider 143 // TODO(brettw): this should probably pass the GURL up so the URL elider
144 // can be used at a higher level when we know the width. 144 // can be used at a higher level when we know the width.
145 string16 url = results_[row].display_url.display_url(); 145 string16 url = results_[row].display_url.display_url();
146 return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(url)); 146 return base::i18n::GetDisplayStringInLTRDirectionality(url);
147 } 147 }
148 148
149 SkBitmap PossibleURLModel::GetIcon(int row) { 149 SkBitmap PossibleURLModel::GetIcon(int row) {
150 if (row < 0 || row >= RowCount()) { 150 if (row < 0 || row >= RowCount()) {
151 NOTREACHED(); 151 NOTREACHED();
152 return *default_fav_icon; 152 return *default_fav_icon;
153 } 153 }
154 154
155 Result& result = results_[row]; 155 Result& result = results_[row];
156 FavIconMap::iterator i = fav_icon_map_.find(result.index); 156 FavIconMap::iterator i = fav_icon_map_.find(result.index);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Notify the observer. 201 // Notify the observer.
202 if (!fav_icon_map_[index].isNull() && observer_) 202 if (!fav_icon_map_[index].isNull() && observer_)
203 observer_->OnItemsChanged(static_cast<int>(index), 1); 203 observer_->OnItemsChanged(static_cast<int>(index), 1);
204 } 204 }
205 } 205 }
206 } 206 }
207 207
208 void PossibleURLModel::SetObserver(TableModelObserver* observer) { 208 void PossibleURLModel::SetObserver(TableModelObserver* observer) {
209 observer_ = observer; 209 observer_ = observer;
210 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698