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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (history_service) { | 253 if (history_service) { |
254 entry.task_id = history_service->QueryURL( | 254 entry.task_id = history_service->QueryURL( |
255 entry.url, | 255 entry.url, |
256 false, | 256 false, |
257 base::Bind(&CustomHomePagesTableModel::OnGotOneOfManyTitles, | 257 base::Bind(&CustomHomePagesTableModel::OnGotOneOfManyTitles, |
258 base::Unretained(this), | 258 base::Unretained(this), |
259 entry.url), | 259 entry.url), |
260 &task_tracker_); | 260 &task_tracker_); |
261 } | 261 } |
262 } | 262 } |
| 263 if (entries_.empty()) |
| 264 observer_->OnModelChanged(); |
263 } | 265 } |
264 | 266 |
265 void CustomHomePagesTableModel::OnGotOneOfManyTitles(const GURL& entry_url, | 267 void CustomHomePagesTableModel::OnGotOneOfManyTitles(const GURL& entry_url, |
266 bool found_url, | 268 bool found_url, |
267 const history::URLRow& row, | 269 const history::URLRow& row, |
268 const history::VisitVector& visits) { | 270 const history::VisitVector& visits) { |
269 OnGotTitle(entry_url, false, found_url, row, visits); | 271 OnGotTitle(entry_url, false, found_url, row, visits); |
270 DCHECK_GE(num_outstanding_title_lookups_, 1); | 272 DCHECK_GE(num_outstanding_title_lookups_, 1); |
271 if (--num_outstanding_title_lookups_ == 0 && observer_) | 273 if (--num_outstanding_title_lookups_ == 0 && observer_) |
272 observer_->OnModelChanged(); | 274 observer_->OnModelChanged(); |
(...skipping 25 matching lines...) Expand all Loading... |
298 } | 300 } |
299 } | 301 } |
300 | 302 |
301 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { | 303 base::string16 CustomHomePagesTableModel::FormattedURL(int row) const { |
302 std::string languages = | 304 std::string languages = |
303 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 305 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
304 base::string16 url = net::FormatUrl(entries_[row].url, languages); | 306 base::string16 url = net::FormatUrl(entries_[row].url, languages); |
305 url = base::i18n::GetDisplayStringInLTRDirectionality(url); | 307 url = base::i18n::GetDisplayStringInLTRDirectionality(url); |
306 return url; | 308 return url; |
307 } | 309 } |
OLD | NEW |