Commit c9bf0ddb authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Retire ScopedObserver in /components/ntp_tiles.

ScopedObserver is being deprecated in favor of two new classes:
- base::ScopedObservation for observers that only ever observe
  a single source.
- base::ScopedMultiSourceObservation for observers that do or may
  observe more than a single source.

This CL was uploaded by git cl split.

R=aee@chromium.org

Bug: 1145565
Change-Id: I48d7536ee7228fb3888849c7b2e4c82523bcd230
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532956
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826818}
parent 82a8d26b
......@@ -20,10 +20,10 @@ namespace ntp_tiles {
CustomLinksManagerImpl::CustomLinksManagerImpl(
PrefService* prefs,
history::HistoryService* history_service)
: prefs_(prefs), store_(prefs), history_service_observer_(this) {
: prefs_(prefs), store_(prefs) {
DCHECK(prefs);
if (history_service)
history_service_observer_.Add(history_service);
history_service_observation_.Observe(history_service);
if (IsInitialized())
current_links_ = store_.RetrieveLinks();
......@@ -226,7 +226,7 @@ void CustomLinksManagerImpl::OnURLsDeleted(
void CustomLinksManagerImpl::HistoryServiceBeingDeleted(
history::HistoryService* history_service) {
history_service_observer_.RemoveAll();
history_service_observation_.RemoveObservation();
}
void CustomLinksManagerImpl::OnPreferenceChanged() {
......
......@@ -11,7 +11,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/scoped_observation.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/ntp_tiles/custom_links_manager.h"
......@@ -95,8 +95,9 @@ class CustomLinksManagerImpl : public CustomLinksManager,
base::CallbackList<void()> callback_list_;
// Observer for the HistoryService.
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
history_service_observer_;
base::ScopedObservation<history::HistoryService,
history::HistoryServiceObserver>
history_service_observation_{this};
// Observer for Chrome sync changes to |prefs::kCustomLinksList| and
// |prefs::kCustomLinksInitialized|.
......
......@@ -218,11 +218,11 @@ void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer,
if (top_sites_) {
// Register as TopSitesObserver so that we can update ourselves when the
// TopSites changes.
top_sites_observer_.Observe(top_sites_.get());
top_sites_observation_.Observe(top_sites_.get());
}
if (repeatable_queries_) {
repeatable_queries_observer_.Observe(repeatable_queries_);
repeatable_queries_observation_.Observe(repeatable_queries_);
}
if (custom_links_) {
......@@ -947,7 +947,7 @@ void MostVisitedSites::OnRepeatableQueriesUpdated() {
}
void MostVisitedSites::OnRepeatableQueriesServiceShuttingDown() {
repeatable_queries_observer_.RemoveObservation();
repeatable_queries_observation_.RemoveObservation();
}
bool MostVisitedSites::ShouldAddHomeTile() const {
......
......@@ -380,11 +380,11 @@ class MostVisitedSites : public history::TopSitesObserver,
suggestions_subscription_;
base::ScopedObservation<history::TopSites, history::TopSitesObserver>
top_sites_observer_{this};
top_sites_observation_{this};
base::ScopedObservation<RepeatableQueriesService,
RepeatableQueriesServiceObserver>
repeatable_queries_observer_{this};
repeatable_queries_observation_{this};
std::unique_ptr<base::CallbackList<void()>::Subscription>
custom_links_subscription_;
......
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