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() : UTF16ToWideHack( | 145 return entries_[row].title.empty() ? std::wstring() : |
146 l10n_util::GetStringFUTF16(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, | 146 l10n_util::GetStringF(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, |
147 WideToUTF16Hack(entries_[row].title), | 147 entries_[row].title, FormattedURL(row)); |
148 WideToUTF16Hack(FormattedURL(row)))); | |
149 } | 148 } |
150 | 149 |
151 void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) { | 150 void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) { |
152 observer_ = observer; | 151 observer_ = observer; |
153 } | 152 } |
154 | 153 |
155 void CustomHomePagesTableModel::LoadTitleAndFavIcon(Entry* entry) { | 154 void CustomHomePagesTableModel::LoadTitleAndFavIcon(Entry* entry) { |
156 HistoryService* history_service = | 155 HistoryService* history_service = |
157 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 156 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
158 if (history_service) { | 157 if (history_service) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 return NULL; | 232 return NULL; |
234 } | 233 } |
235 | 234 |
236 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { | 235 std::wstring CustomHomePagesTableModel::FormattedURL(int row) const { |
237 std::string languages = | 236 std::string languages = |
238 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 237 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
239 string16 url = net::FormatUrl(entries_[row].url, languages); | 238 string16 url = net::FormatUrl(entries_[row].url, languages); |
240 url = base::i18n::GetDisplayStringInLTRDirectionality(url); | 239 url = base::i18n::GetDisplayStringInLTRDirectionality(url); |
241 return UTF16ToWide(url); | 240 return UTF16ToWide(url); |
242 } | 241 } |
OLD | NEW |