OLD | NEW |
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/custom_home_pages_table_model.h" | 5 #include "chrome/browser/custom_home_pages_table_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "app/table_model_observer.h" | 9 #include "app/table_model_observer.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DCHECK(row >= 0 && row < RowCount()); | 135 DCHECK(row >= 0 && row < RowCount()); |
136 return entries_[row].title.empty() ? FormattedURL(row) : entries_[row].title; | 136 return entries_[row].title.empty() ? FormattedURL(row) : entries_[row].title; |
137 } | 137 } |
138 | 138 |
139 SkBitmap CustomHomePagesTableModel::GetIcon(int row) { | 139 SkBitmap CustomHomePagesTableModel::GetIcon(int row) { |
140 DCHECK(row >= 0 && row < RowCount()); | 140 DCHECK(row >= 0 && row < RowCount()); |
141 return entries_[row].icon.isNull() ? *default_favicon_ : entries_[row].icon; | 141 return entries_[row].icon.isNull() ? *default_favicon_ : entries_[row].icon; |
142 } | 142 } |
143 | 143 |
144 std::wstring CustomHomePagesTableModel::GetTooltip(int row) { | 144 std::wstring CustomHomePagesTableModel::GetTooltip(int row) { |
145 return entries_[row].title.empty() ? std::wstring() : | 145 return entries_[row].title.empty() ? std::wstring() : UTF16ToWideHack( |
146 l10n_util::GetStringF(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, | 146 l10n_util::GetStringFUTF16(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, |
147 entries_[row].title, FormattedURL(row)); | 147 WideToUTF16Hack(entries_[row].title), |
| 148 WideToUTF16Hack(FormattedURL(row)))); |
148 } | 149 } |
149 | 150 |
150 void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) { | 151 void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) { |
151 observer_ = observer; | 152 observer_ = observer; |
152 } | 153 } |
153 | 154 |
154 void CustomHomePagesTableModel::LoadTitleAndFavIcon(Entry* entry) { | 155 void CustomHomePagesTableModel::LoadTitleAndFavIcon(Entry* entry) { |
155 HistoryService* history_service = | 156 HistoryService* history_service = |
156 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 157 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
157 if (history_service) { | 158 if (history_service) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return NULL; | 233 return NULL; |
233 } | 234 } |
234 | 235 |
235 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { | 236 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { |
236 std::string languages = | 237 std::string languages = |
237 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 238 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
238 string16 url = net::FormatUrl(entries_[row].url, languages); | 239 string16 url = net::FormatUrl(entries_[row].url, languages); |
239 url = base::i18n::GetDisplayStringInLTRDirectionality(url); | 240 url = base::i18n::GetDisplayStringInLTRDirectionality(url); |
240 return UTF16ToWide(url); | 241 return UTF16ToWide(url); |
241 } | 242 } |
OLD | NEW |