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

Side by Side Diff: components/history/core/browser/history_service.cc

Issue 2750313002: Extend HistoryService with support for favicons from Google servers (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 618 DCHECK(backend_task_runner_) << "History service being called after cleanup";
619 DCHECK(thread_checker_.CalledOnValidThread()); 619 DCHECK(thread_checker_.CalledOnValidThread());
620 if (history_client_ && !history_client_->CanAddURL(page_url)) 620 if (history_client_ && !history_client_->CanAddURL(page_url))
621 return; 621 return;
622 622
623 ScheduleTask(PRIORITY_NORMAL, 623 ScheduleTask(PRIORITY_NORMAL,
624 base::Bind(&HistoryBackend::SetFavicons, history_backend_, 624 base::Bind(&HistoryBackend::SetFavicons, history_backend_,
625 page_url, icon_type, icon_url, bitmaps)); 625 page_url, icon_type, icon_url, bitmaps));
626 } 626 }
627 627
628 void HistoryService::SetExpiredFaviconsIfNoneKnown(
brettw 2017/03/20 21:37:31 This name is hard to make sense of without underst
629 const GURL& page_url,
630 favicon_base::IconType icon_type,
631 const GURL& icon_url,
632 const std::vector<SkBitmap>& bitmaps,
633 base::Callback<void(bool)> callback) {
634 DCHECK(backend_task_runner_) << "History service being called after cleanup";
635 DCHECK(thread_checker_.CalledOnValidThread());
636 if (history_client_ && !history_client_->CanAddURL(page_url))
637 return;
638
639 PostTaskAndReplyWithResult(
640 FROM_HERE,
641 base::Bind(&HistoryBackend::SetExpiredFaviconsIfNoneKnown,
642 history_backend_, page_url, icon_type, icon_url, bitmaps),
643 callback);
644 }
645
628 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { 646 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) {
629 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 647 DCHECK(backend_task_runner_) << "History service being called after cleanup";
630 DCHECK(thread_checker_.CalledOnValidThread()); 648 DCHECK(thread_checker_.CalledOnValidThread());
631 ScheduleTask(PRIORITY_NORMAL, 649 ScheduleTask(PRIORITY_NORMAL,
632 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage, 650 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage,
633 history_backend_, page_url)); 651 history_backend_, page_url));
634 } 652 }
635 653
636 void HistoryService::SetImportedFavicons( 654 void HistoryService::SetImportedFavicons(
637 const favicon_base::FaviconUsageDataList& favicon_usage) { 655 const favicon_base::FaviconUsageDataList& favicon_usage) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 return favicon_changed_callback_list_.Add(callback); 1167 return favicon_changed_callback_list_.Add(callback);
1150 } 1168 }
1151 1169
1152 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1170 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1153 const GURL& icon_url) { 1171 const GURL& icon_url) {
1154 DCHECK(thread_checker_.CalledOnValidThread()); 1172 DCHECK(thread_checker_.CalledOnValidThread());
1155 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1173 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1156 } 1174 }
1157 1175
1158 } // namespace history 1176 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698