Commit 7c5a055c authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Add HistoryService::FaviconChangedCallback type alias.

This makes it easier to track down and/or change types.

Also renames CallbackList -> RepeatingCallbackList.

Bug: 1113007
Change-Id: I42357489f2c3e7a19b0f4909fe20ca7dc9ff4339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354225Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMaksim Moskvitin <mmoskvitin@google.com>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797771}
parent 930f85c4
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h" #include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/history/core/browser/history_client.h" #include "components/history/core/browser/history_client.h"
#include "components/history/core/browser/history_service.h"
class GURL; class GURL;
...@@ -60,8 +61,8 @@ class ChromeHistoryClient : public history::HistoryClient, ...@@ -60,8 +61,8 @@ class ChromeHistoryClient : public history::HistoryClient,
base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_; base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
// Subscription for notifications of changes to favicons. // Subscription for notifications of changes to favicons.
std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, std::unique_ptr<
const GURL&)>::Subscription> history::HistoryService::FaviconsChangedCallbackList::Subscription>
favicons_changed_subscription_; favicons_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient);
......
...@@ -236,8 +236,8 @@ class FaviconForPageUrlAvailableChecker : public StatusChangeChecker { ...@@ -236,8 +236,8 @@ class FaviconForPageUrlAvailableChecker : public StatusChangeChecker {
Profile* const profile_; Profile* const profile_;
const GURL page_url_; const GURL page_url_;
const bool should_be_available_; const bool should_be_available_;
std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, std::unique_ptr<
const GURL&)>::Subscription> history::HistoryService::FaviconsChangedCallbackList::Subscription>
callback_subscription_; callback_subscription_;
bool exit_condition_satisfied_ = false; bool exit_condition_satisfied_ = false;
base::CancelableTaskTracker tracker_; base::CancelableTaskTracker tracker_;
......
...@@ -1241,18 +1241,17 @@ void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) { ...@@ -1241,18 +1241,17 @@ void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) {
observer.OnKeywordSearchTermDeleted(this, url_id); observer.OnKeywordSearchTermDeleted(this, url_id);
} }
std::unique_ptr< std::unique_ptr<HistoryService::FaviconsChangedCallbackList::Subscription>
base::CallbackList<void(const std::set<GURL>&, const GURL&)>::Subscription>
HistoryService::AddFaviconsChangedCallback( HistoryService::AddFaviconsChangedCallback(
const HistoryService::OnFaviconsChangedCallback& callback) { const HistoryService::FaviconsChangedCallback& callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return favicon_changed_callback_list_.Add(callback); return favicons_changed_callback_list_.Add(callback);
} }
void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
const GURL& icon_url) { const GURL& icon_url) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
favicon_changed_callback_list_.Notify(page_urls, icon_url); favicons_changed_callback_list_.Notify(page_urls, icon_url);
} }
} // namespace history } // namespace history
...@@ -479,15 +479,15 @@ class HistoryService : public KeyedService { ...@@ -479,15 +479,15 @@ class HistoryService : public KeyedService {
// icon URL (e.g. http://www.google.com/favicon.ico) for which the favicon // icon URL (e.g. http://www.google.com/favicon.ico) for which the favicon
// data has changed. It is valid to call the callback with non-empty // data has changed. It is valid to call the callback with non-empty
// "page URLs" and no "icon URL" and vice versa. // "page URLs" and no "icon URL" and vice versa.
using OnFaviconsChangedCallback = using FaviconsChangedCallbackList =
base::RepeatingCallback<void(const std::set<GURL>&, const GURL&)>; base::RepeatingCallbackList<void(const std::set<GURL>&, const GURL&)>;
using FaviconsChangedCallback = FaviconsChangedCallbackList::CallbackType;
// Add a callback to the list. The callback will remain registered until the // Add a callback to the list. The callback will remain registered until the
// returned Subscription is destroyed. The Subscription must be destroyed // returned Subscription is destroyed. The Subscription must be destroyed
// before HistoryService is destroyed. // before HistoryService is destroyed.
std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, std::unique_ptr<FaviconsChangedCallbackList::Subscription>
const GURL&)>::Subscription> AddFaviconsChangedCallback(const FaviconsChangedCallback& callback)
AddFaviconsChangedCallback(const OnFaviconsChangedCallback& callback)
WARN_UNUSED_RESULT; WARN_UNUSED_RESULT;
// Testing ------------------------------------------------------------------- // Testing -------------------------------------------------------------------
...@@ -874,8 +874,7 @@ class HistoryService : public KeyedService { ...@@ -874,8 +874,7 @@ class HistoryService : public KeyedService {
bool backend_loaded_; bool backend_loaded_;
base::ObserverList<HistoryServiceObserver>::Unchecked observers_; base::ObserverList<HistoryServiceObserver>::Unchecked observers_;
base::CallbackList<void(const std::set<GURL>&, const GURL&)> FaviconsChangedCallbackList favicons_changed_callback_list_;
favicon_changed_callback_list_;
std::unique_ptr<DeleteDirectiveHandler> delete_directive_handler_; std::unique_ptr<DeleteDirectiveHandler> delete_directive_handler_;
......
...@@ -146,8 +146,8 @@ class FaviconCache : public history::HistoryServiceObserver { ...@@ -146,8 +146,8 @@ class FaviconCache : public history::HistoryServiceObserver {
base::MRUCache<Request, bool> responses_without_favicons_; base::MRUCache<Request, bool> responses_without_favicons_;
// Subscription for notifications of changes to favicons. // Subscription for notifications of changes to favicons.
std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, std::unique_ptr<
const GURL&)>::Subscription> history::HistoryService::FaviconsChangedCallbackList::Subscription>
favicons_changed_subscription_; favicons_changed_subscription_;
base::WeakPtrFactory<FaviconCache> weak_factory_{this}; base::WeakPtrFactory<FaviconCache> weak_factory_{this};
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h" #include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/history/core/browser/history_client.h" #include "components/history/core/browser/history_client.h"
#include "components/history/core/browser/history_service.h"
class GURL; class GURL;
...@@ -58,8 +59,8 @@ class HistoryClientImpl : public history::HistoryClient, ...@@ -58,8 +59,8 @@ class HistoryClientImpl : public history::HistoryClient,
base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_; base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
// Subscription for notifications of changes to favicons. // Subscription for notifications of changes to favicons.
std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, std::unique_ptr<
const GURL&)>::Subscription> history::HistoryService::FaviconsChangedCallbackList::Subscription>
favicons_changed_subscription_; favicons_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(HistoryClientImpl); DISALLOW_COPY_AND_ASSIGN(HistoryClientImpl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment