| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return entries_[row].title.empty() ? base::string16() : | 213 return entries_[row].title.empty() ? base::string16() : |
| 214 l10n_util::GetStringFUTF16(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, | 214 l10n_util::GetStringFUTF16(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP, |
| 215 entries_[row].title, FormattedURL(row)); | 215 entries_[row].title, FormattedURL(row)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void CustomHomePagesTableModel::SetObserver(ui::TableModelObserver* observer) { | 218 void CustomHomePagesTableModel::SetObserver(ui::TableModelObserver* observer) { |
| 219 observer_ = observer; | 219 observer_ = observer; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CustomHomePagesTableModel::LoadTitle(Entry* entry) { | 222 void CustomHomePagesTableModel::LoadTitle(Entry* entry) { |
| 223 HistoryService* history_service = HistoryServiceFactory::GetForProfile( | 223 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 224 profile_, Profile::EXPLICIT_ACCESS); | 224 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 225 if (history_service) { | 225 if (history_service) { |
| 226 entry->task_id = history_service->QueryURL( | 226 entry->task_id = history_service->QueryURL( |
| 227 entry->url, | 227 entry->url, |
| 228 false, | 228 false, |
| 229 base::Bind(&CustomHomePagesTableModel::OnGotTitle, | 229 base::Bind(&CustomHomePagesTableModel::OnGotTitle, |
| 230 base::Unretained(this), | 230 base::Unretained(this), |
| 231 entry->url), | 231 entry->url), |
| 232 &task_tracker_); | 232 &task_tracker_); |
| 233 } | 233 } |
| 234 } | 234 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { | 261 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { |
| 262 std::string languages = | 262 std::string languages = |
| 263 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 263 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 264 base::string16 url = net::FormatUrl(entries_[row].url, languages); | 264 base::string16 url = net::FormatUrl(entries_[row].url, languages); |
| 265 url = base::i18n::GetDisplayStringInLTRDirectionality(url); | 265 url = base::i18n::GetDisplayStringInLTRDirectionality(url); |
| 266 return url; | 266 return url; |
| 267 } | 267 } |
| OLD | NEW |