Convert CallbackList::Subscription to a standalone class.
Bug: 1103086
AX-Relnotes: n/a.
TBR: pinkerton
Change-Id: I3b241eb7234727f314dd85d1bdbb3a41ceca5938
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522860
Reviewed-by: Peter Kasting <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: danakj <[email protected]>
Commit-Queue: Peter Kasting <[email protected]>
Auto-Submit: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#830015}
diff --git a/ash/app_list/views/search_result_actions_view.h b/ash/app_list/views/search_result_actions_view.h
index 78d793c..d75c90a 100644
--- a/ash/app_list/views/search_result_actions_view.h
+++ b/ash/app_list/views/search_result_actions_view.h
@@ -79,7 +79,7 @@
base::Optional<int> selected_action_;
SearchResultActionsViewDelegate* const delegate_; // Not owned.
- std::list<views::PropertyChangedSubscription> subscriptions_;
+ std::list<base::CallbackListSubscription> subscriptions_;
DISALLOW_COPY_AND_ASSIGN(SearchResultActionsView);
};
diff --git a/ash/clipboard/views/clipboard_history_item_view.h b/ash/clipboard/views/clipboard_history_item_view.h
index 3d5e075..c90c8f6 100644
--- a/ash/clipboard/views/clipboard_history_item_view.h
+++ b/ash/clipboard/views/clipboard_history_item_view.h
@@ -184,7 +184,7 @@
// through `main_button_` or the delete button.
ClipboardHistoryUtil::Action action_ = ClipboardHistoryUtil::Action::kEmpty;
- views::PropertyChangedSubscription subscription_;
+ base::CallbackListSubscription subscription_;
};
} // namespace ash
diff --git a/ash/frame/non_client_frame_view_ash.h b/ash/frame/non_client_frame_view_ash.h
index 988f89d..069c104 100644
--- a/ash/frame/non_client_frame_view_ash.h
+++ b/ash/frame/non_client_frame_view_ash.h
@@ -142,11 +142,10 @@
std::unique_ptr<NonClientFrameViewAshImmersiveHelper> immersive_helper_;
- std::unique_ptr<views::Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_ =
- frame_->RegisterPaintAsActiveChangedCallback(
- base::BindRepeating(&NonClientFrameViewAsh::PaintAsActiveChanged,
- base::Unretained(this)));
+ base::CallbackListSubscription paint_as_active_subscription_ =
+ frame_->RegisterPaintAsActiveChangedCallback(
+ base::BindRepeating(&NonClientFrameViewAsh::PaintAsActiveChanged,
+ base::Unretained(this)));
base::WeakPtrFactory<NonClientFrameViewAsh> weak_factory_{this};
diff --git a/ash/frame/wide_frame_view.h b/ash/frame/wide_frame_view.h
index 58fe6f2..cb4e52c 100644
--- a/ash/frame/wide_frame_view.h
+++ b/ash/frame/wide_frame_view.h
@@ -87,8 +87,7 @@
// Called when |target_|'s "paint as active" state has changed.
void PaintAsActiveChanged();
- std::unique_ptr<views::Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_;
+ base::CallbackListSubscription paint_as_active_subscription_;
DISALLOW_COPY_AND_ASSIGN(WideFrameView);
};
diff --git a/ash/login/ui/login_pin_view.cc b/ash/login/ui/login_pin_view.cc
index 41cbdc4..18e4e41 100644
--- a/ash/login/ui/login_pin_view.cc
+++ b/ash/login/ui/login_pin_view.cc
@@ -356,7 +356,7 @@
std::make_unique<base::RepeatingTimer>();
views::ImageView* image_ = nullptr;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(base::BindRepeating(
&LoginPinView::BackspacePinButton::OnEnabledChanged,
base::Unretained(this)));
@@ -399,7 +399,7 @@
private:
views::ImageView* image_ = nullptr;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&LoginPinView::SubmitPinButton::OnEnabledChanged,
base::Unretained(this)));
diff --git a/ash/public/cpp/holding_space/holding_space_image.cc b/ash/public/cpp/holding_space/holding_space_image.cc
index 8453f69b..355a7e645 100644
--- a/ash/public/cpp/holding_space/holding_space_image.cc
+++ b/ash/public/cpp/holding_space/holding_space_image.cc
@@ -75,8 +75,7 @@
return gfx::BitmapsAreEqual(*image_skia_.bitmap(), *rhs.image_skia_.bitmap());
}
-std::unique_ptr<HoldingSpaceImage::Subscription>
-HoldingSpaceImage::AddImageSkiaChangedCallback(
+base::CallbackListSubscription HoldingSpaceImage::AddImageSkiaChangedCallback(
CallbackList::CallbackType callback) const {
return callback_list_.Add(std::move(callback));
}
diff --git a/ash/public/cpp/holding_space/holding_space_image.h b/ash/public/cpp/holding_space/holding_space_image.h
index e614d82..0ef74b0 100644
--- a/ash/public/cpp/holding_space/holding_space_image.h
+++ b/ash/public/cpp/holding_space/holding_space_image.h
@@ -18,7 +18,6 @@
class ASH_PUBLIC_EXPORT HoldingSpaceImage {
public:
using CallbackList = base::RepeatingClosureList;
- using Subscription = CallbackList::Subscription;
// Returns a bitmap.
using BitmapCallback = base::OnceCallback<void(const SkBitmap*)>;
@@ -36,7 +35,7 @@
bool operator==(const HoldingSpaceImage& rhs) const;
// Adds `callback` to be notified of changes to the underlying `image_skia_`.
- std::unique_ptr<Subscription> AddImageSkiaChangedCallback(
+ base::CallbackListSubscription AddImageSkiaChangedCallback(
CallbackList::CallbackType callback) const;
// Returns the underlying `gfx::ImageSkia`. Note that the image source may be
diff --git a/ash/search_box/search_box_view_base.h b/ash/search_box/search_box_view_base.h
index 6ffdcf0..4d9925b4 100644
--- a/ash/search_box/search_box_view_base.h
+++ b/ash/search_box/search_box_view_base.h
@@ -199,7 +199,7 @@
// Whether to show assistant button.
bool show_assistant_button_ = false;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&SearchBoxViewBase::OnEnabledChanged,
base::Unretained(this)));
diff --git a/ash/system/holding_space/holding_space_item_chip_view.h b/ash/system/holding_space/holding_space_item_chip_view.h
index 858ad6b..d80c78a 100644
--- a/ash/system/holding_space/holding_space_item_chip_view.h
+++ b/ash/system/holding_space/holding_space_item_chip_view.h
@@ -48,7 +48,7 @@
views::Label* label_ = nullptr;
views::View* label_and_pin_button_container_ = nullptr;
- std::unique_ptr<HoldingSpaceImage::Subscription> image_subscription_;
+ base::CallbackListSubscription image_subscription_;
};
} // namespace ash
diff --git a/ash/system/holding_space/holding_space_item_screen_capture_view.h b/ash/system/holding_space/holding_space_item_screen_capture_view.h
index 4ccf488f..246db6b 100644
--- a/ash/system/holding_space/holding_space_item_screen_capture_view.h
+++ b/ash/system/holding_space/holding_space_item_screen_capture_view.h
@@ -34,7 +34,7 @@
RoundedImageView* image_ = nullptr;
- std::unique_ptr<HoldingSpaceImage::Subscription> image_subscription_;
+ base::CallbackListSubscription image_subscription_;
};
} // namespace ash
diff --git a/ash/system/holding_space/holding_space_tray_icon_preview.cc b/ash/system/holding_space/holding_space_tray_icon_preview.cc
index 0bd4ba53..aa58e5d 100644
--- a/ash/system/holding_space/holding_space_tray_icon_preview.cc
+++ b/ash/system/holding_space/holding_space_tray_icon_preview.cc
@@ -146,7 +146,7 @@
}
base::RepeatingClosure image_invalidated_closure_;
- std::unique_ptr<HoldingSpaceImage::Subscription> image_subscription_;
+ base::CallbackListSubscription image_subscription_;
};
} // namespace
diff --git a/ash/system/tray/hover_highlight_view.h b/ash/system/tray/hover_highlight_view.h
index 7b48c9f..b90972f 100644
--- a/ash/system/tray/hover_highlight_view.h
+++ b/ash/system/tray/hover_highlight_view.h
@@ -120,7 +120,7 @@
TriView* tri_view_ = nullptr;
bool expandable_ = false;
AccessibilityState accessibility_state_ = AccessibilityState::DEFAULT;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&HoverHighlightView::OnEnabledChanged,
base::Unretained(this)));
diff --git a/ash/system/unified/feature_pod_button.h b/ash/system/unified/feature_pod_button.h
index 60ef165..dfdd6f0 100644
--- a/ash/system/unified/feature_pod_button.h
+++ b/ash/system/unified/feature_pod_button.h
@@ -99,7 +99,7 @@
views::Label* const label_;
views::Label* const sub_label_;
views::ImageView* const detailed_view_arrow_;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&FeaturePodLabelButton::OnEnabledChanged,
base::Unretained(this)));
@@ -191,7 +191,7 @@
// expanded.
bool visible_preferred_ = true;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&FeaturePodButton::OnEnabledChanged,
base::Unretained(this)));
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 777221a0..09f25d1 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -166,6 +166,7 @@
"callback_helpers.h",
"callback_internal.cc",
"callback_internal.h",
+ "callback_list.cc",
"callback_list.h",
"cancelable_callback.h",
"check.cc",
diff --git a/base/callback_list.cc b/base/callback_list.cc
new file mode 100644
index 0000000..62a2ac2
--- /dev/null
+++ b/base/callback_list.cc
@@ -0,0 +1,39 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/callback_list.h"
+
+#include <utility>
+
+#include "base/callback.h"
+
+namespace base {
+
+CallbackListSubscription::CallbackListSubscription() = default;
+
+CallbackListSubscription::CallbackListSubscription(base::OnceClosure closure)
+ : closure_(std::move(closure)) {}
+
+CallbackListSubscription::CallbackListSubscription(
+ CallbackListSubscription&& subscription)
+ : closure_(std::move(subscription.closure_)) {}
+
+CallbackListSubscription& CallbackListSubscription::operator=(
+ CallbackListSubscription&& subscription) {
+ // Note: This still works properly for self-assignment.
+ Run();
+ closure_ = std::move(subscription.closure_);
+ return *this;
+}
+
+CallbackListSubscription::~CallbackListSubscription() {
+ Run();
+}
+
+void CallbackListSubscription::Run() {
+ if (closure_)
+ std::move(closure_).Run();
+}
+
+} // namespace base
diff --git a/base/callback_list.h b/base/callback_list.h
index 1778541..97edd71 100644
--- a/base/callback_list.h
+++ b/base/callback_list.h
@@ -10,6 +10,7 @@
#include <utility>
#include "base/auto_reset.h"
+#include "base/base_export.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
@@ -32,8 +33,7 @@
// using CallbackList = base::RepeatingCallbackList<void(const Foo&)>;
//
// // Registers |cb| to be called whenever NotifyFoo() is executed.
-// std::unique_ptr<CallbackList::Subscription>
-// RegisterCallback(CallbackList::CallbackType cb) {
+// CallbackListSubscription RegisterCallback(CallbackList::CallbackType cb) {
// return callback_list_.Add(std::move(cb));
// }
//
@@ -51,13 +51,13 @@
// private:
// void OnFoo(const Foo& foo) {
// // Called whenever MyWidget::NotifyFoo() is executed, unless
-// // |foo_subscription_| has been reset().
+// // |foo_subscription_| has been destroyed.
// }
//
// // Automatically deregisters the callback when deleted (e.g. in
// // ~MyWidgetListener()). Unretained(this) is safe here since the
-// // Subscription does not outlive |this|.
-// std::unique_ptr<MyWidget::CallbackList::Subscription> foo_subscription_ =
+// // ScopedClosureRunner does not outlive |this|.
+// CallbackListSubscription foo_subscription_ =
// MyWidget::Get()->RegisterCallback(
// base::BindRepeating(&MyWidgetListener::OnFoo,
// base::Unretained(this)));
@@ -70,6 +70,10 @@
// This is possible to support, but not currently necessary.
namespace base {
+namespace internal {
+template <typename CallbackListImpl>
+class CallbackListBase;
+} // namespace internal
template <typename Signature>
class OnceCallbackList;
@@ -77,6 +81,33 @@
template <typename Signature>
class RepeatingCallbackList;
+// A trimmed-down version of ScopedClosureRunner that can be used to guarantee a
+// closure is run on destruction. This is designed to be used by
+// CallbackListBase to run CancelCallback() when this subscription dies;
+// consumers can avoid callbacks on dead objects by ensuring the subscription
+// returned by CallbackListBase::Add() does not outlive the bound object in the
+// callback. A typical way to do this is to bind a callback to a member function
+// on `this` and store the returned subscription as a member variable.
+class BASE_EXPORT CallbackListSubscription {
+ public:
+ CallbackListSubscription();
+ CallbackListSubscription(CallbackListSubscription&& subscription);
+ CallbackListSubscription& operator=(CallbackListSubscription&& subscription);
+ ~CallbackListSubscription();
+
+ explicit operator bool() const { return !!closure_; }
+
+ private:
+ template <typename T>
+ friend class internal::CallbackListBase;
+
+ explicit CallbackListSubscription(base::OnceClosure closure);
+
+ void Run();
+
+ OnceClosure closure_;
+};
+
namespace internal {
// A traits class to break circular type dependencies between CallbackListBase
@@ -104,26 +135,9 @@
typename CallbackListTraits<CallbackListImpl>::CallbackType;
static_assert(IsBaseCallback<CallbackType>::value, "");
- // A cancellation handle for callers who register callbacks. Subscription
- // destruction cancels the associated callback and is legal any time,
- // including after the destruction of the CallbackList that vends it.
- class Subscription {
- public:
- explicit Subscription(base::OnceClosure destruction_closure)
- : destruction_closure_(std::move(destruction_closure)) {}
-
- Subscription(Subscription&&) = default;
- Subscription& operator=(Subscription&&) = default;
-
- ~Subscription() { std::move(destruction_closure_).Run(); }
-
- private:
- // Run when |this| is destroyed to notify the CallbackList the associated
- // callback should be canceled. Since this is bound using a WeakPtr to the
- // CallbackList, it will automatically no-op if the CallbackList no longer
- // exists.
- base::OnceClosure destruction_closure_;
- };
+ // TODO(crbug.com/1103086): Update references to use this directly and by
+ // value, then remove.
+ using Subscription = CallbackListSubscription;
CallbackListBase() = default;
CallbackListBase(const CallbackListBase&) = delete;
@@ -134,11 +148,11 @@
CHECK(!iterating_);
}
- // Registers |cb| for future notifications. Returns a Subscription that can be
- // used to cancel |cb|.
- std::unique_ptr<Subscription> Add(CallbackType cb) WARN_UNUSED_RESULT {
+ // Registers |cb| for future notifications. Returns a CallbackListSubscription
+ // whose destruction will cancel |cb|.
+ CallbackListSubscription Add(CallbackType cb) WARN_UNUSED_RESULT {
DCHECK(!cb.is_null());
- return std::make_unique<Subscription>(base::BindOnce(
+ return CallbackListSubscription(base::BindOnce(
&CallbackListBase::CancelCallback, weak_ptr_factory_.GetWeakPtr(),
callbacks_.insert(callbacks_.end(), std::move(cb))));
}
diff --git a/base/callback_list_unittest.cc b/base/callback_list_unittest.cc
index b187743..945592b 100644
--- a/base/callback_list_unittest.cc
+++ b/base/callback_list_unittest.cc
@@ -33,7 +33,6 @@
int scaler_ = 1;
};
-template <typename T>
class Remover {
public:
Remover() = default;
@@ -43,18 +42,18 @@
void IncrementTotalAndRemove() {
++total_;
- removal_subscription_.reset();
+ removal_subscription_ = {};
}
- void SetSubscriptionToRemove(std::unique_ptr<typename T::Subscription> sub) {
- removal_subscription_ = std::move(sub);
+ void SetSubscriptionToRemove(CallbackListSubscription subscription) {
+ removal_subscription_ = std::move(subscription);
}
int total() const { return total_; }
private:
int total_ = 0;
- std::unique_ptr<typename T::Subscription> removal_subscription_;
+ CallbackListSubscription removal_subscription_;
};
class Adder {
@@ -81,7 +80,7 @@
bool added_ = false;
int total_ = 0;
RepeatingClosureList* cb_reg_;
- std::unique_ptr<RepeatingClosureList::Subscription> subscription_;
+ CallbackListSubscription subscription_;
};
class Summer {
@@ -128,51 +127,43 @@
Summer s;
RepeatingCallbackList<void(int)> c1;
- std::unique_ptr<RepeatingCallbackList<void(int)>::Subscription>
- subscription1 =
- c1.Add(BindRepeating(&Summer::AddOneParam, Unretained(&s)));
+ CallbackListSubscription subscription1 =
+ c1.Add(BindRepeating(&Summer::AddOneParam, Unretained(&s)));
c1.Notify(1);
EXPECT_EQ(1, s.value());
RepeatingCallbackList<void(int, int)> c2;
- std::unique_ptr<RepeatingCallbackList<void(int, int)>::Subscription>
- subscription2 =
- c2.Add(BindRepeating(&Summer::AddTwoParam, Unretained(&s)));
+ CallbackListSubscription subscription2 =
+ c2.Add(BindRepeating(&Summer::AddTwoParam, Unretained(&s)));
c2.Notify(1, 2);
EXPECT_EQ(3, s.value());
RepeatingCallbackList<void(int, int, int)> c3;
- std::unique_ptr<RepeatingCallbackList<void(int, int, int)>::Subscription>
- subscription3 =
- c3.Add(BindRepeating(&Summer::AddThreeParam, Unretained(&s)));
+ CallbackListSubscription subscription3 =
+ c3.Add(BindRepeating(&Summer::AddThreeParam, Unretained(&s)));
c3.Notify(1, 2, 3);
EXPECT_EQ(6, s.value());
RepeatingCallbackList<void(int, int, int, int)> c4;
- std::unique_ptr<RepeatingCallbackList<void(int, int, int, int)>::Subscription>
- subscription4 =
- c4.Add(BindRepeating(&Summer::AddFourParam, Unretained(&s)));
+ CallbackListSubscription subscription4 =
+ c4.Add(BindRepeating(&Summer::AddFourParam, Unretained(&s)));
c4.Notify(1, 2, 3, 4);
EXPECT_EQ(10, s.value());
RepeatingCallbackList<void(int, int, int, int, int)> c5;
- std::unique_ptr<
- RepeatingCallbackList<void(int, int, int, int, int)>::Subscription>
- subscription5 =
- c5.Add(BindRepeating(&Summer::AddFiveParam, Unretained(&s)));
+ CallbackListSubscription subscription5 =
+ c5.Add(BindRepeating(&Summer::AddFiveParam, Unretained(&s)));
c5.Notify(1, 2, 3, 4, 5);
EXPECT_EQ(15, s.value());
RepeatingCallbackList<void(int, int, int, int, int, int)> c6;
- std::unique_ptr<
- RepeatingCallbackList<void(int, int, int, int, int, int)>::Subscription>
- subscription6 =
- c6.Add(BindRepeating(&Summer::AddSixParam, Unretained(&s)));
+ CallbackListSubscription subscription6 =
+ c6.Add(BindRepeating(&Summer::AddSixParam, Unretained(&s)));
c6.Notify(1, 2, 3, 4, 5, 6);
EXPECT_EQ(21, s.value());
@@ -184,14 +175,14 @@
Listener a, b, c;
RepeatingClosureList cb_reg;
- std::unique_ptr<RepeatingClosureList::Subscription> a_subscription =
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&a)));
- std::unique_ptr<RepeatingClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&b)));
cb_reg.AddUnsafe(BindRepeating(&Listener::IncrementTotal, Unretained(&c)));
- EXPECT_TRUE(a_subscription.get());
- EXPECT_TRUE(b_subscription.get());
+ EXPECT_TRUE(a_subscription);
+ EXPECT_TRUE(b_subscription);
cb_reg.Notify();
@@ -199,9 +190,9 @@
EXPECT_EQ(1, b.total());
EXPECT_EQ(1, c.total());
- b_subscription.reset();
+ b_subscription = {};
- std::unique_ptr<RepeatingClosureList::Subscription> c_subscription =
+ CallbackListSubscription c_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&c)));
cb_reg.Notify();
@@ -216,13 +207,13 @@
OnceClosureList cb_reg;
Listener a, b, c;
- std::unique_ptr<OnceClosureList::Subscription> a_subscription =
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&a)));
- std::unique_ptr<OnceClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&b)));
- EXPECT_TRUE(a_subscription.get());
- EXPECT_TRUE(b_subscription.get());
+ EXPECT_TRUE(a_subscription);
+ EXPECT_TRUE(b_subscription);
cb_reg.Notify();
@@ -234,9 +225,9 @@
// Destroying a subscription after the callback is canceled should not cause
// any problems.
- b_subscription.reset();
+ b_subscription = {};
- std::unique_ptr<OnceClosureList::Subscription> c_subscription =
+ CallbackListSubscription c_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&c)));
cb_reg.Notify();
@@ -253,22 +244,22 @@
CallbackListType cb_reg;
Listener a(1), b(-1), c(1);
- std::unique_ptr<CallbackListType::Subscription> a_subscription = cb_reg.Add(
+ CallbackListSubscription a_subscription = cb_reg.Add(
BindRepeating(&Listener::IncrementByMultipleOfScaler, Unretained(&a)));
- std::unique_ptr<CallbackListType::Subscription> b_subscription = cb_reg.Add(
+ CallbackListSubscription b_subscription = cb_reg.Add(
BindRepeating(&Listener::IncrementByMultipleOfScaler, Unretained(&b)));
- EXPECT_TRUE(a_subscription.get());
- EXPECT_TRUE(b_subscription.get());
+ EXPECT_TRUE(a_subscription);
+ EXPECT_TRUE(b_subscription);
cb_reg.Notify(10);
EXPECT_EQ(10, a.total());
EXPECT_EQ(-10, b.total());
- b_subscription.reset();
+ b_subscription = {};
- std::unique_ptr<CallbackListType::Subscription> c_subscription = cb_reg.Add(
+ CallbackListSubscription c_subscription = cb_reg.Add(
BindRepeating(&Listener::IncrementByMultipleOfScaler, Unretained(&c)));
cb_reg.Notify(10);
@@ -283,19 +274,15 @@
TEST(CallbackListTest, RemoveCallbacksDuringIteration) {
RepeatingClosureList cb_reg;
Listener a, b;
- Remover<RepeatingClosureList> remover_1, remover_2;
+ Remover remover_1, remover_2;
- std::unique_ptr<RepeatingClosureList::Subscription> remover_1_sub =
- cb_reg.Add(
- BindRepeating(&Remover<RepeatingClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_1)));
- std::unique_ptr<RepeatingClosureList::Subscription> remover_2_sub =
- cb_reg.Add(
- BindRepeating(&Remover<RepeatingClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_2)));
- std::unique_ptr<RepeatingClosureList::Subscription> a_subscription =
+ CallbackListSubscription remover_1_sub = cb_reg.Add(
+ BindRepeating(&Remover::IncrementTotalAndRemove, Unretained(&remover_1)));
+ CallbackListSubscription remover_2_sub = cb_reg.Add(
+ BindRepeating(&Remover::IncrementTotalAndRemove, Unretained(&remover_2)));
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&a)));
- std::unique_ptr<RepeatingClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&b)));
// |remover_1| will remove itself.
@@ -326,17 +313,15 @@
TEST(CallbackListTest, RemoveOnceCallbacksDuringIteration) {
OnceClosureList cb_reg;
Listener a, b;
- Remover<OnceClosureList> remover_1, remover_2;
+ Remover remover_1, remover_2;
- std::unique_ptr<OnceClosureList::Subscription> remover_1_sub =
- cb_reg.Add(BindOnce(&Remover<OnceClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_1)));
- std::unique_ptr<OnceClosureList::Subscription> remover_2_sub =
- cb_reg.Add(BindOnce(&Remover<OnceClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_2)));
- std::unique_ptr<OnceClosureList::Subscription> a_subscription =
+ CallbackListSubscription remover_1_sub = cb_reg.Add(
+ BindOnce(&Remover::IncrementTotalAndRemove, Unretained(&remover_1)));
+ CallbackListSubscription remover_2_sub = cb_reg.Add(
+ BindOnce(&Remover::IncrementTotalAndRemove, Unretained(&remover_2)));
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&a)));
- std::unique_ptr<OnceClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&b)));
// |remover_1| will remove itself.
@@ -369,9 +354,9 @@
RepeatingClosureList cb_reg;
Adder a(&cb_reg);
Listener b;
- std::unique_ptr<RepeatingClosureList::Subscription> a_subscription =
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindRepeating(&Adder::AddCallback, Unretained(&a)));
- std::unique_ptr<RepeatingClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&b)));
cb_reg.Notify();
@@ -399,9 +384,9 @@
// Declare items such that |cb_reg| is torn down before the subscriptions.
// This ensures the removal callback's invariant that the callback list is
// nonempty will always hold.
- Remover<RepeatingClosureList> remover;
+ Remover remover;
Listener listener;
- std::unique_ptr<RepeatingClosureList::Subscription> remover_sub, listener_sub;
+ CallbackListSubscription remover_sub, listener_sub;
RepeatingClosureList cb_reg;
cb_reg.set_removal_callback(base::BindRepeating(
[](const RepeatingClosureList* callbacks) {
@@ -410,8 +395,7 @@
Unretained(&cb_reg)));
remover_sub = cb_reg.Add(
- BindRepeating(&Remover<RepeatingClosureList>::IncrementTotalAndRemove,
- Unretained(&remover)));
+ BindRepeating(&Remover::IncrementTotalAndRemove, Unretained(&remover)));
listener_sub = cb_reg.Add(
BindRepeating(&Listener::IncrementTotal, Unretained(&listener)));
@@ -432,12 +416,11 @@
[](const OnceClosureList* callbacks) { EXPECT_TRUE(callbacks->empty()); },
Unretained(&cb_reg)));
- Remover<OnceClosureList> remover;
+ Remover remover;
Listener listener;
- std::unique_ptr<OnceClosureList::Subscription> remover_sub =
- cb_reg.Add(BindOnce(&Remover<OnceClosureList>::IncrementTotalAndRemove,
- Unretained(&remover)));
- std::unique_ptr<OnceClosureList::Subscription> listener_sub =
+ CallbackListSubscription remover_sub = cb_reg.Add(
+ BindOnce(&Remover::IncrementTotalAndRemove, Unretained(&remover)));
+ CallbackListSubscription listener_sub =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&listener)));
// |remover| will remove |listener|.
@@ -455,24 +438,19 @@
cb_reg.set_removal_callback(
BindRepeating(&Counter::Increment, Unretained(&remove_count)));
- std::unique_ptr<RepeatingClosureList::Subscription> subscription =
- cb_reg.Add(DoNothing());
+ CallbackListSubscription subscription = cb_reg.Add(DoNothing());
// Removing a subscription outside of iteration signals the callback.
EXPECT_EQ(0, remove_count.value());
- subscription.reset();
+ subscription = {};
EXPECT_EQ(1, remove_count.value());
// Configure two subscriptions to remove themselves.
- Remover<RepeatingClosureList> remover_1, remover_2;
- std::unique_ptr<RepeatingClosureList::Subscription> remover_1_sub =
- cb_reg.Add(
- BindRepeating(&Remover<RepeatingClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_1)));
- std::unique_ptr<RepeatingClosureList::Subscription> remover_2_sub =
- cb_reg.Add(
- BindRepeating(&Remover<RepeatingClosureList>::IncrementTotalAndRemove,
- Unretained(&remover_2)));
+ Remover remover_1, remover_2;
+ CallbackListSubscription remover_1_sub = cb_reg.Add(
+ BindRepeating(&Remover::IncrementTotalAndRemove, Unretained(&remover_1)));
+ CallbackListSubscription remover_2_sub = cb_reg.Add(
+ BindRepeating(&Remover::IncrementTotalAndRemove, Unretained(&remover_2)));
remover_1.SetSubscriptionToRemove(std::move(remover_1_sub));
remover_2.SetSubscriptionToRemove(std::move(remover_2_sub));
@@ -485,7 +463,7 @@
TEST(CallbackListTest, AbandonSubscriptions) {
Listener listener;
- std::unique_ptr<RepeatingClosureList::Subscription> subscription;
+ CallbackListSubscription subscription;
{
RepeatingClosureList cb_reg;
subscription = cb_reg.Add(
@@ -497,16 +475,15 @@
EXPECT_EQ(1, listener.total());
// Destroying the subscription after the list should not cause any problems.
- subscription.reset();
+ subscription = {};
}
// Subscriptions should be movable.
TEST(CallbackListTest, MoveSubscription) {
RepeatingClosureList cb_reg;
Listener listener;
- std::unique_ptr<RepeatingClosureList::Subscription> subscription1 =
- cb_reg.Add(
- BindRepeating(&Listener::IncrementTotal, Unretained(&listener)));
+ CallbackListSubscription subscription1 = cb_reg.Add(
+ BindRepeating(&Listener::IncrementTotal, Unretained(&listener)));
cb_reg.Notify();
EXPECT_EQ(1, listener.total());
@@ -514,7 +491,7 @@
cb_reg.Notify();
EXPECT_EQ(2, listener.total());
- subscription2.reset();
+ subscription2 = {};
cb_reg.Notify();
EXPECT_EQ(2, listener.total());
}
@@ -523,13 +500,13 @@
OnceClosureList cb_reg;
Listener a;
- std::unique_ptr<OnceClosureList::Subscription> a_subscription =
+ CallbackListSubscription a_subscription =
cb_reg.Add(BindOnce(&Listener::IncrementTotal, Unretained(&a)));
- EXPECT_TRUE(a_subscription.get());
+ EXPECT_TRUE(a_subscription);
// Canceling a OnceCallback before running it should not cause problems.
- a_subscription.reset();
+ a_subscription = {};
cb_reg.Notify();
// |a| should not have received any callbacks.
@@ -541,57 +518,53 @@
TEST(CallbackListTest, ReentrantNotify) {
RepeatingClosureList cb_reg;
Listener a, b, c, d;
- std::unique_ptr<RepeatingClosureList::Subscription> a_subscription,
- c_subscription;
+ CallbackListSubscription a_subscription, c_subscription;
// A callback to run for |a|.
- const auto a_callback =
- [](RepeatingClosureList* callbacks, Listener* a,
- std::unique_ptr<RepeatingClosureList::Subscription>* a_subscription,
- const Listener* b, Listener* c,
- std::unique_ptr<RepeatingClosureList::Subscription>* c_subscription,
- Listener* d) {
- // This should be the first callback.
- EXPECT_EQ(0, a->total());
- EXPECT_EQ(0, b->total());
- EXPECT_EQ(0, c->total());
- EXPECT_EQ(0, d->total());
+ const auto a_callback = [](RepeatingClosureList* callbacks, Listener* a,
+ CallbackListSubscription* a_subscription,
+ const Listener* b, Listener* c,
+ CallbackListSubscription* c_subscription,
+ Listener* d) {
+ // This should be the first callback.
+ EXPECT_EQ(0, a->total());
+ EXPECT_EQ(0, b->total());
+ EXPECT_EQ(0, c->total());
+ EXPECT_EQ(0, d->total());
- // Increment |a| once.
- a->IncrementTotal();
+ // Increment |a| once.
+ a->IncrementTotal();
- // Prevent |a| from being incremented again during the reentrant
- // Notify(). Since this is the first callback, this also verifies the
- // inner Notify() doesn't assume the first callback (or all callbacks)
- // are valid.
- a_subscription->reset();
+ // Prevent |a| from being incremented again during the reentrant Notify().
+ // Since this is the first callback, this also verifies the inner Notify()
+ // doesn't assume the first callback (or all callbacks) are valid.
+ *a_subscription = {};
- // Add |c| and |d| to be incremented by the reentrant Notify().
- *c_subscription = callbacks->Add(
- BindRepeating(&Listener::IncrementTotal, Unretained(c)));
- std::unique_ptr<RepeatingClosureList::Subscription> d_subscription =
- callbacks->Add(
- BindRepeating(&Listener::IncrementTotal, Unretained(d)));
+ // Add |c| and |d| to be incremented by the reentrant Notify().
+ *c_subscription =
+ callbacks->Add(BindRepeating(&Listener::IncrementTotal, Unretained(c)));
+ CallbackListSubscription d_subscription =
+ callbacks->Add(BindRepeating(&Listener::IncrementTotal, Unretained(d)));
- // Notify reentrantly. This should not increment |a|, but all the
- // others should be incremented.
- callbacks->Notify();
- EXPECT_EQ(1, b->total());
- EXPECT_EQ(1, c->total());
- EXPECT_EQ(1, d->total());
+ // Notify reentrantly. This should not increment |a|, but all the others
+ // should be incremented.
+ callbacks->Notify();
+ EXPECT_EQ(1, b->total());
+ EXPECT_EQ(1, c->total());
+ EXPECT_EQ(1, d->total());
- // Since |d_subscription| is locally scoped, it should be canceled
- // before the outer Notify() increments |d|. |c_subscription| already
- // exists and thus |c| should get incremented again by the outer
- // Notify() even though it wasn't subscribed when that was called.
- };
+ // Since |d_subscription| is locally scoped, it should be canceled before
+ // the outer Notify() increments |d|. |c_subscription| already exists and
+ // thus |c| should get incremented again by the outer Notify() even though
+ // it wasn't scoped when that was called.
+ };
// Add |a| and |b| to the list to be notified, and notify.
a_subscription = cb_reg.Add(
BindRepeating(a_callback, Unretained(&cb_reg), Unretained(&a),
Unretained(&a_subscription), Unretained(&b), Unretained(&c),
Unretained(&c_subscription), Unretained(&d)));
- std::unique_ptr<RepeatingClosureList::Subscription> b_subscription =
+ CallbackListSubscription b_subscription =
cb_reg.Add(BindRepeating(&Listener::IncrementTotal, Unretained(&b)));
// Execute both notifications and check the cumulative effect.
diff --git a/base/callback_list_unittest.nc b/base/callback_list_unittest.nc
index e24ecbed..0d010c0 100644
--- a/base/callback_list_unittest.nc
+++ b/base/callback_list_unittest.nc
@@ -44,7 +44,7 @@
void WontCompile() {
FooListener f;
CallbackList<void(std::unique_ptr<Foo>)> c1;
- std::unique_ptr<CallbackList<void(std::unique_ptr<Foo>)>::Subscription> sub =
+ CallbackListSubscription sub =
c1.Add(BindRepeating(&FooListener::GotAScopedFoo, Unretained(&f)));
c1.Notify(std::unique_ptr<Foo>(new Foo()));
}
diff --git a/chrome/browser/android/foreign_session_helper.h b/chrome/browser/android/foreign_session_helper.h
index 33614e2..efbbe60a 100644
--- a/chrome/browser/android/foreign_session_helper.h
+++ b/chrome/browser/android/foreign_session_helper.h
@@ -47,8 +47,7 @@
Profile* profile_; // weak
base::android::ScopedJavaGlobalRef<jobject> callback_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- foreign_session_updated_subscription_;
+ base::CallbackListSubscription foreign_session_updated_subscription_;
DISALLOW_COPY_AND_ASSIGN(ForeignSessionHelper);
};
diff --git a/chrome/browser/android/oom_intervention/near_oom_monitor.cc b/chrome/browser/android/oom_intervention/near_oom_monitor.cc
index 48452359..b4b0922 100644
--- a/chrome/browser/android/oom_intervention/near_oom_monitor.cc
+++ b/chrome/browser/android/oom_intervention/near_oom_monitor.cc
@@ -56,7 +56,7 @@
NearOomMonitor::~NearOomMonitor() = default;
-std::unique_ptr<NearOomMonitor::Subscription> NearOomMonitor::RegisterCallback(
+base::CallbackListSubscription NearOomMonitor::RegisterCallback(
base::RepeatingClosure callback) {
if (callbacks_.empty() && !ComponentCallbackIsEnabled())
ScheduleCheck();
diff --git a/chrome/browser/android/oom_intervention/near_oom_monitor.h b/chrome/browser/android/oom_intervention/near_oom_monitor.h
index 480b5a51..a7ab8b9 100644
--- a/chrome/browser/android/oom_intervention/near_oom_monitor.h
+++ b/chrome/browser/android/oom_intervention/near_oom_monitor.h
@@ -30,12 +30,11 @@
base::TimeDelta GetCooldownInterval() const { return cooldown_interval_; }
using CallbackList = base::CallbackList<void()>;
- using Subscription = CallbackList::Subscription;
// Registers a callback which is invoked when this monitor detects near-OOM
// situation. The callback will be called on the task runner on which this
- // monitor is running. Destroy the returned Subscription to unregister.
- std::unique_ptr<Subscription> RegisterCallback(
+ // monitor is running. Destroy the returned subscription to unregister.
+ base::CallbackListSubscription RegisterCallback(
base::RepeatingClosure callback);
void OnLowMemory(JNIEnv* env,
diff --git a/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc b/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc
index 63e1fe0f..634be7c 100644
--- a/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc
+++ b/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc
@@ -60,7 +60,7 @@
&TestNearOomObserver::OnNearOomDetected, base::Unretained(this)));
}
- void Unsubscribe() { subscription_.reset(); }
+ void Unsubscribe() { subscription_ = {}; }
bool is_detected() const { return is_detected_; }
@@ -68,7 +68,7 @@
void OnNearOomDetected() { is_detected_ = true; }
bool is_detected_ = false;
- std::unique_ptr<NearOomMonitor::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(TestNearOomObserver);
};
diff --git a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.cc b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.cc
index 56633765..c19237a 100644
--- a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.cc
+++ b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.cc
@@ -241,7 +241,7 @@
if (OomInterventionConfig::GetInstance()->should_detect_in_renderer()) {
ResetInterfaces();
} else {
- subscription_.reset();
+ subscription_ = {};
}
}
@@ -286,7 +286,7 @@
DCHECK(!OomInterventionConfig::GetInstance()->should_detect_in_renderer());
DCHECK_EQ(web_contents()->GetVisibility(), content::Visibility::VISIBLE);
DCHECK(!near_oom_detected_time_);
- subscription_.reset();
+ subscription_ = {};
StartDetectionInRenderer();
DCHECK(!renderer_detection_timer_.IsRunning());
diff --git a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
index a862a25d..ca85438 100644
--- a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
+++ b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
@@ -90,7 +90,7 @@
bool navigation_started_ = false;
bool load_finished_ = false;
base::Optional<base::TimeTicks> near_oom_detected_time_;
- std::unique_ptr<NearOomMonitor::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
base::OneShotTimer renderer_detection_timer_;
// Not owned. This will be nullptr in incognito mode.
diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h
index 8d0a2df..6d346cd5 100644
--- a/chrome/browser/browser_process_platform_part_chromeos.h
+++ b/chrome/browser/browser_process_platform_part_chromeos.h
@@ -169,8 +169,7 @@
std::unique_ptr<chromeos::InSessionPasswordChangeManager>
in_session_password_change_manager_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- primary_profile_shutdown_subscription_;
+ base::CallbackListSubscription primary_profile_shutdown_subscription_;
std::unique_ptr<chromeos::SchedulerConfigurationManager>
scheduler_configuration_manager_;
diff --git a/chrome/browser/browser_switcher/browser_switcher_prefs.cc b/chrome/browser/browser_switcher/browser_switcher_prefs.cc
index 0017736e..d4d457bd 100644
--- a/chrome/browser/browser_switcher/browser_switcher_prefs.cc
+++ b/chrome/browser/browser_switcher/browser_switcher_prefs.cc
@@ -241,7 +241,7 @@
weak_ptr_factory_.GetWeakPtr()));
}
-std::unique_ptr<BrowserSwitcherPrefs::CallbackSubscription>
+base::CallbackListSubscription
BrowserSwitcherPrefs::RegisterPrefsChangedCallback(
BrowserSwitcherPrefs::PrefsChangedCallback cb) {
return callback_list_.Add(cb);
diff --git a/chrome/browser/browser_switcher/browser_switcher_prefs.h b/chrome/browser/browser_switcher/browser_switcher_prefs.h
index 21773858..1937d44 100644
--- a/chrome/browser/browser_switcher/browser_switcher_prefs.h
+++ b/chrome/browser/browser_switcher/browser_switcher_prefs.h
@@ -50,8 +50,6 @@
public:
using PrefsChangedCallback = base::RepeatingCallback<PrefsChangedSignature>;
- using CallbackSubscription =
- base::CallbackList<PrefsChangedSignature>::Subscription;
explicit BrowserSwitcherPrefs(Profile* profile);
~BrowserSwitcherPrefs() override;
@@ -125,7 +123,7 @@
const policy::PolicyMap& previous,
const policy::PolicyMap& current) override;
- std::unique_ptr<CallbackSubscription> RegisterPrefsChangedCallback(
+ base::CallbackListSubscription RegisterPrefsChangedCallback(
PrefsChangedCallback cb);
protected:
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.cc b/chrome/browser/browser_switcher/browser_switcher_service.cc
index cefc70d92..81cbea9 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service.cc
+++ b/chrome/browser/browser_switcher/browser_switcher_service.cc
@@ -331,7 +331,7 @@
std::move(all_rulesets_loaded_callback_for_testing_).Run();
}
-std::unique_ptr<BrowserSwitcherService::CallbackSubscription>
+base::CallbackListSubscription
BrowserSwitcherService::RegisterAllRulesetsParsedCallback(
AllRulesetsParsedCallback callback) {
return callback_list_.Add(callback);
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.h b/chrome/browser/browser_switcher/browser_switcher_service.h
index 91073e0..7f33db8 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service.h
+++ b/chrome/browser/browser_switcher/browser_switcher_service.h
@@ -118,8 +118,6 @@
using AllRulesetsParsedCallbackSignature = void(BrowserSwitcherService*);
using AllRulesetsParsedCallback =
base::RepeatingCallback<AllRulesetsParsedCallbackSignature>;
- using CallbackSubscription =
- base::CallbackList<AllRulesetsParsedCallbackSignature>::Subscription;
public:
explicit BrowserSwitcherService(Profile* profile);
@@ -187,15 +185,14 @@
// Registers a callback that triggers after the sitelists are done downloading
// and all rules are applied.
- std::unique_ptr<CallbackSubscription> RegisterAllRulesetsParsedCallback(
+ base::CallbackListSubscription RegisterAllRulesetsParsedCallback(
AllRulesetsParsedCallback callback);
std::unique_ptr<XmlDownloader> sitelist_downloader_;
Profile* profile_;
BrowserSwitcherPrefs prefs_;
- std::unique_ptr<BrowserSwitcherPrefs::CallbackSubscription>
- prefs_subscription_;
+ base::CallbackListSubscription prefs_subscription_;
// CallbackList for OnAllRulesetsParsed() listeners.
base::CallbackList<AllRulesetsParsedCallbackSignature> callback_list_;
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index 5b9a5de..df7538a 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -415,8 +415,7 @@
captive_portal::CaptivePortalService* captive_portal_service_;
- std::unique_ptr<captive_portal::CaptivePortalService::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
// Last result received.
CaptivePortalResult captive_portal_result_;
diff --git a/chrome/browser/chrome_browser_main_posix.cc b/chrome/browser/chrome_browser_main_posix.cc
index a29a692..25741e2d 100644
--- a/chrome/browser/chrome_browser_main_posix.cc
+++ b/chrome/browser/chrome_browser_main_posix.cc
@@ -54,11 +54,10 @@
// Points to the on-session-restored callback that was registered with
// SessionRestore's callback list. When objects of this class are destroyed,
- // the subscription object's destructor will automatically unregister the
- // callback in SessionRestore, so that the callback list does not contain any
- // obsolete callbacks.
- SessionRestore::CallbackSubscription
- on_session_restored_callback_subscription_;
+ // the subscription's destructor will automatically unregister the callback in
+ // SessionRestore, so that the callback list does not contain any obsolete
+ // callbacks.
+ base::CallbackListSubscription on_session_restored_callback_subscription_;
DISALLOW_COPY_AND_ASSIGN(ExitHandler);
};
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
index 613e0b85..6cd87fc 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -1210,8 +1210,8 @@
return audio::SoundsManager::Get()->GetDuration(SOUND_SHUTDOWN);
}
-std::unique_ptr<AccessibilityStatusSubscription>
-AccessibilityManager::RegisterCallback(const AccessibilityStatusCallback& cb) {
+base::CallbackListSubscription AccessibilityManager::RegisterCallback(
+ const AccessibilityStatusCallback& cb) {
return callback_list_.Add(cb);
}
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.h b/chrome/browser/chromeos/accessibility/accessibility_manager.h
index 30bfdf9..a5eb34f 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.h
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.h
@@ -84,8 +84,6 @@
base::RepeatingCallbackList<void(const AccessibilityStatusEventDetails&)>;
using AccessibilityStatusCallback =
AccessibilityStatusCallbackList::CallbackType;
-using AccessibilityStatusSubscription =
- AccessibilityStatusCallbackList::Subscription;
class AccessibilityPanelWidgetObserver;
@@ -233,7 +231,7 @@
// Register a callback to be notified when the status of an accessibility
// option changes.
- std::unique_ptr<AccessibilityStatusSubscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const AccessibilityStatusCallback& cb) WARN_UNUSED_RESULT;
// Notify registered callbacks of a status change in an accessibility setting.
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
index 462eff9..30bfbc5 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
@@ -91,7 +91,7 @@
bool observed_enabled_ = false;
int observed_type_ = -1;
- std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
DISALLOW_COPY_AND_ASSIGN(MockAccessibilityObserver);
};
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
index 425bd5c..f526b3a0 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
+++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
@@ -142,7 +142,7 @@
bool observed_ = false;
bool observed_enabled_ = false;
- std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
DISALLOW_COPY_AND_ASSIGN(MockMagnificationObserver);
};
diff --git a/chrome/browser/chromeos/account_manager/account_manager_policy_controller.cc b/chrome/browser/chromeos/account_manager/account_manager_policy_controller.cc
index 4336fa9..02a19d2 100644
--- a/chrome/browser/chromeos/account_manager/account_manager_policy_controller.cc
+++ b/chrome/browser/chromeos/account_manager/account_manager_policy_controller.cc
@@ -169,7 +169,7 @@
}
void AccountManagerPolicyController::Shutdown() {
- child_account_type_changed_subscription_.reset();
+ child_account_type_changed_subscription_ = {};
edu_coexistence_consent_invalidation_controller_.reset();
}
diff --git a/chrome/browser/chromeos/account_manager/account_manager_policy_controller.h b/chrome/browser/chromeos/account_manager/account_manager_policy_controller.h
index 679402b6..3879470 100644
--- a/chrome/browser/chromeos/account_manager/account_manager_policy_controller.h
+++ b/chrome/browser/chromeos/account_manager/account_manager_policy_controller.h
@@ -72,8 +72,7 @@
// For listening on Pref changes.
PrefChangeRegistrar pref_change_registrar_;
- std::unique_ptr<chromeos::ChildAccountTypeChangedSubscription>
- child_account_type_changed_subscription_;
+ base::CallbackListSubscription child_account_type_changed_subscription_;
std::unique_ptr<EduCoexistenceConsentInvalidationController>
edu_coexistence_consent_invalidation_controller_;
diff --git a/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.cc b/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.cc
index 7e64a953..38b33822 100644
--- a/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.cc
+++ b/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.cc
@@ -42,7 +42,7 @@
return value_;
}
-std::unique_ptr<base::CallbackList<void(bool)>::Subscription>
+base::CallbackListSubscription
ChildAccountTypeChangedUserData::RegisterCallback(
const base::RepeatingCallback<void(bool)>& cb) {
return callback_list_.Add(cb);
diff --git a/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.h b/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.h
index ccfeb7a8a..1802e157 100644
--- a/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.h
+++ b/chrome/browser/chromeos/account_manager/child_account_type_changed_user_data.h
@@ -13,9 +13,6 @@
class Profile;
namespace chromeos {
-typedef base::CallbackList<void(bool)>::Subscription
- ChildAccountTypeChangedSubscription;
-
class ChildAccountTypeChangedUserData : public base::SupportsUserData::Data {
public:
ChildAccountTypeChangedUserData();
@@ -32,7 +29,7 @@
void SetValue(bool value);
bool value() const;
- std::unique_ptr<ChildAccountTypeChangedSubscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const base::RepeatingCallback<void(bool)>& cb);
private:
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
index b86055b3..7c17118 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
@@ -708,8 +708,8 @@
}
void KioskAppManager::CleanUp() {
- local_accounts_subscription_.reset();
- local_account_auto_login_id_subscription_.reset();
+ local_accounts_subscription_ = {};
+ local_account_auto_login_id_subscription_ = {};
apps_.clear();
usb_stick_updater_.reset();
external_cache_.reset();
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_manager_base.h b/chrome/browser/chromeos/app_mode/kiosk_app_manager_base.h
index 6ceb7a9..6123f5d 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_manager_base.h
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_manager_base.h
@@ -89,10 +89,8 @@
bool auto_launched_with_zero_delay_ = false;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- local_accounts_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- local_account_auto_login_id_subscription_;
+ base::CallbackListSubscription local_accounts_subscription_;
+ base::CallbackListSubscription local_account_auto_login_id_subscription_;
// Current app session.
std::unique_ptr<AppSession> app_session_;
diff --git a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h
index e620fbed..2ba43bb 100644
--- a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h
+++ b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h
@@ -185,8 +185,7 @@
std::map<int32_t, int32_t> window_id_to_task_id_;
- std::unique_ptr<chromeos::AccessibilityStatusSubscription>
- accessibility_status_subscription_;
+ base::CallbackListSubscription accessibility_status_subscription_;
arc::mojom::AccessibilityFilterType filter_type_ =
arc::mojom::AccessibilityFilterType::OFF;
diff --git a/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.h b/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.h
index 9378283..2a9be23 100644
--- a/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.h
+++ b/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.h
@@ -51,8 +51,7 @@
// Observers for preferences and settings changes.
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- receiver_name_subscription_;
+ base::CallbackListSubscription receiver_name_subscription_;
DISALLOW_COPY_AND_ASSIGN(ArcCastReceiverService);
};
diff --git a/chrome/browser/chromeos/arc/input_method_manager/arc_input_method_manager_service.h b/chrome/browser/chromeos/arc/input_method_manager/arc_input_method_manager_service.h
index b9c7869d6..9da1dc5 100644
--- a/chrome/browser/chromeos/arc/input_method_manager/arc_input_method_manager_service.h
+++ b/chrome/browser/chromeos/arc/input_method_manager/arc_input_method_manager_service.h
@@ -161,8 +161,7 @@
std::unique_ptr<ArcInputMethodBoundsObserver> input_method_bounds_observer_;
- std::unique_ptr<chromeos::AccessibilityStatusSubscription>
- accessibility_status_subscription_;
+ base::CallbackListSubscription accessibility_status_subscription_;
base::ObserverList<Observer> observers_;
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc
index cecab05..ced4cc23 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc
@@ -224,13 +224,11 @@
// Manages pref observation registration.
PrefChangeRegistrar registrar_;
- std::unique_ptr<chromeos::StatsReportingController::ObserverSubscription>
- reporting_consent_subscription_;
+ base::CallbackListSubscription reporting_consent_subscription_;
// Subscription for preference change of default zoom level. Subscription
// automatically unregisters a callback when it's destructed.
- std::unique_ptr<ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
- default_zoom_level_subscription_;
+ base::CallbackListSubscription default_zoom_level_subscription_;
// Name of the default network. Used to keep track of whether the default
// network has changed.
@@ -377,7 +375,7 @@
void ArcSettingsServiceImpl::StopObservingSettingsChanges() {
registrar_.RemoveAll();
- reporting_consent_subscription_.reset();
+ reporting_consent_subscription_ = {};
TimezoneSettings::GetInstance()->RemoveObserver(this);
chromeos::NetworkHandler::Get()->network_state_handler()->RemoveObserver(
diff --git a/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h b/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h
index 560fcb6..e93ddcc 100644
--- a/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h
+++ b/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h
@@ -58,8 +58,7 @@
// Used to track backup&restore and location service preference.
PrefChangeRegistrar pref_change_registrar_;
// Metrics consent observer.
- std::unique_ptr<chromeos::StatsReportingController::ObserverSubscription>
- reporting_consent_subscription_;
+ base::CallbackListSubscription reporting_consent_subscription_;
DISALLOW_COPY_AND_ASSIGN(ArcOptInPreferenceHandler);
};
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer.h b/chrome/browser/chromeos/attestation/attestation_policy_observer.h
index 36097fc..38b5f866 100644
--- a/chrome/browser/chromeos/attestation/attestation_policy_observer.h
+++ b/chrome/browser/chromeos/attestation/attestation_policy_observer.h
@@ -40,7 +40,7 @@
CrosSettings* cros_settings_;
MachineCertificateUploader* certificate_uploader_;
- std::unique_ptr<CrosSettings::ObserverSubscription> attestation_subscription_;
+ base::CallbackListSubscription attestation_subscription_;
DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver);
};
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
index e88725a..61bc783 100644
--- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
+++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -4383,7 +4383,7 @@
} else {
Respond(Error("Failed to set metrics consent"));
}
- stats_reporting_observer_subscription_.reset();
+ stats_reporting_observer_subscription_ = {};
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
index 4e56087..1a8979a 100644
--- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
+++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
@@ -1190,8 +1190,7 @@
void OnStatsReportingStateChanged();
- std::unique_ptr<chromeos::StatsReportingController::ObserverSubscription>
- stats_reporting_observer_subscription_;
+ base::CallbackListSubscription stats_reporting_observer_subscription_;
bool target_value_ = false;
};
diff --git a/chrome/browser/chromeos/extensions/printing/printing_apitest.cc b/chrome/browser/chromeos/extensions/printing/printing_apitest.cc
index 7257dcd..0d7faab 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_apitest.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_apitest.cc
@@ -119,9 +119,7 @@
context, base::BindRepeating(&BuildTestCupsPrintersManager));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
scoped_refptr<printing::TestPrintBackend> test_print_backend_;
};
diff --git a/chrome/browser/chromeos/extensions/printing_metrics/print_job_finished_event_dispatcher_apitest.cc b/chrome/browser/chromeos/extensions/printing_metrics/print_job_finished_event_dispatcher_apitest.cc
index 85b6c44e..5f935ae3 100644
--- a/chrome/browser/chromeos/extensions/printing_metrics/print_job_finished_event_dispatcher_apitest.cc
+++ b/chrome/browser/chromeos/extensions/printing_metrics/print_job_finished_event_dispatcher_apitest.cc
@@ -67,9 +67,7 @@
context, base::BindRepeating(&BuildTestCupsPrintJobManager));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
DISALLOW_COPY_AND_ASSIGN(PrintJobFinishedEventDispatcherApiTest);
};
diff --git a/chrome/browser/chromeos/extensions/printing_metrics/printing_metrics_apitest.cc b/chrome/browser/chromeos/extensions/printing_metrics/printing_metrics_apitest.cc
index 24eaf90..a210ced8 100644
--- a/chrome/browser/chromeos/extensions/printing_metrics/printing_metrics_apitest.cc
+++ b/chrome/browser/chromeos/extensions/printing_metrics/printing_metrics_apitest.cc
@@ -69,9 +69,7 @@
context, base::BindRepeating(&BuildTestCupsPrintJobManager));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
DISALLOW_COPY_AND_ASSIGN(PrintingMetricsApiTest);
};
diff --git a/chrome/browser/chromeos/input_method/ui/suggestion_window_view.h b/chrome/browser/chromeos/input_method/ui/suggestion_window_view.h
index 802fe71..f8a7ffa 100644
--- a/chrome/browser/chromeos/input_method/ui/suggestion_window_view.h
+++ b/chrome/browser/chromeos/input_method/ui/suggestion_window_view.h
@@ -101,8 +101,7 @@
SuggestionView* highlighted_candidate_ = nullptr;
// TODO(crbug/1099062): Add tests for mouse hovered and pressed.
- base::flat_map<views::View*, views::PropertyChangedSubscription>
- subscriptions_;
+ base::flat_map<views::View*, base::CallbackListSubscription> subscriptions_;
};
} // namespace ime
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc
index b9e44a1..5eaca153 100644
--- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc
+++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc
@@ -62,8 +62,8 @@
}
void AutoEnrollmentCheckScreen::ClearState() {
- auto_enrollment_progress_subscription_.reset();
- connect_request_subscription_.reset();
+ auto_enrollment_progress_subscription_ = {};
+ connect_request_subscription_ = {};
network_portal_detector::GetInstance()->RemoveObserver(this);
auto_enrollment_state_ = policy::AUTO_ENROLLMENT_STATE_IDLE;
@@ -262,8 +262,8 @@
VLOG(1) << "AutoEnrollmentCheckScreen::SignalCompletion()";
network_portal_detector::GetInstance()->RemoveObserver(this);
- auto_enrollment_progress_subscription_.reset();
- connect_request_subscription_.reset();
+ auto_enrollment_progress_subscription_ = {};
+ connect_request_subscription_ = {};
// Running exit callback can cause `this` destruction, so let other methods
// finish their work before.
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h
index c8ba3e04..ba5c9ff 100644
--- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h
+++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h
@@ -116,15 +116,14 @@
base::RepeatingClosure exit_callback_;
AutoEnrollmentController* auto_enrollment_controller_;
- std::unique_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
- auto_enrollment_progress_subscription_;
+ base::CallbackListSubscription auto_enrollment_progress_subscription_;
NetworkPortalDetector::CaptivePortalStatus captive_portal_status_;
policy::AutoEnrollmentState auto_enrollment_state_;
std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_;
- ErrorScreen::ConnectRequestCallbackSubscription connect_request_subscription_;
+ base::CallbackListSubscription connect_request_subscription_;
base::WeakPtrFactory<AutoEnrollmentCheckScreen> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
index 5241bf9..7e411ff1 100644
--- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
+++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
@@ -517,7 +517,7 @@
Start();
}
-std::unique_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
+base::CallbackListSubscription
AutoEnrollmentController::RegisterProgressCallback(
const ProgressCallbackList::CallbackType& callback) {
return progress_callbacks_.Add(callback);
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h
index f4f8c4c8..0d718c7 100644
--- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h
+++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h
@@ -137,7 +137,7 @@
void Retry();
// Registers a callback to invoke on state changes.
- std::unique_ptr<ProgressCallbackList::Subscription> RegisterProgressCallback(
+ base::CallbackListSubscription RegisterProgressCallback(
const ProgressCallbackList::CallbackType& callback);
policy::AutoEnrollmentState state() const { return state_; }
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 4316aae..667ffc0 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -380,18 +380,13 @@
std::unique_ptr<login::NetworkStateHelper> network_state_helper_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- show_user_names_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- allow_new_user_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription> users_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- local_account_auto_login_id_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- local_account_auto_login_delay_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- family_link_allowed_subscription_;
+ base::CallbackListSubscription show_user_names_subscription_;
+ base::CallbackListSubscription allow_new_user_subscription_;
+ base::CallbackListSubscription allow_guest_subscription_;
+ base::CallbackListSubscription users_subscription_;
+ base::CallbackListSubscription local_account_auto_login_id_subscription_;
+ base::CallbackListSubscription local_account_auto_login_delay_subscription_;
+ base::CallbackListSubscription family_link_allowed_subscription_;
std::unique_ptr<OAuth2TokenInitializer> oauth2_token_initializer_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller_auto_login_unittest.cc b/chrome/browser/chromeos/login/existing_user_controller_auto_login_unittest.cc
index de88219c..115a03a 100644
--- a/chrome/browser/chromeos/login/existing_user_controller_auto_login_unittest.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller_auto_login_unittest.cc
@@ -82,10 +82,9 @@
settings_helper_.Set(kAccountsPrefDeviceLocalAccounts, accounts);
// Prevent settings changes from auto-starting the timer.
- existing_user_controller_->local_account_auto_login_id_subscription_
- .reset();
- existing_user_controller_->local_account_auto_login_delay_subscription_
- .reset();
+ existing_user_controller_->local_account_auto_login_id_subscription_ = {};
+ existing_user_controller_
+ ->local_account_auto_login_delay_subscription_ = {};
}
ExistingUserController* existing_user_controller() const {
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
index 506f7b33..c3cfdcee 100644
--- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -475,7 +475,7 @@
// If both settings have changed we need to wait for both to
// propagate, so check the new values against the old ones.
scoped_refptr<content::MessageLoopRunner> runner1;
- std::unique_ptr<CrosSettings::ObserverSubscription> subscription1;
+ base::CallbackListSubscription subscription1;
if (!proto.has_device_local_accounts() ||
!proto.device_local_accounts().has_auto_login_id() ||
proto.device_local_accounts().auto_login_id() != user_email) {
@@ -485,7 +485,7 @@
base::BindLambdaForTesting([&]() { runner1->Quit(); }));
}
scoped_refptr<content::MessageLoopRunner> runner2;
- std::unique_ptr<CrosSettings::ObserverSubscription> subscription2;
+ base::CallbackListSubscription subscription2;
if (!proto.has_device_local_accounts() ||
!proto.device_local_accounts().has_auto_login_delay() ||
proto.device_local_accounts().auto_login_delay() != delay) {
diff --git a/chrome/browser/chromeos/login/saml/saml_browsertest.cc b/chrome/browser/chromeos/login/saml/saml_browsertest.cc
index a8ec994..1a3e77f 100644
--- a/chrome/browser/chromeos/login/saml/saml_browsertest.cc
+++ b/chrome/browser/chromeos/login/saml/saml_browsertest.cc
@@ -1402,7 +1402,7 @@
proto.mutable_saml_settings()->set_transfer_saml_cookies(true);
base::RunLoop run_loop;
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(kAccountsPrefTransferSAMLCookies,
run_loop.QuitClosure());
device_policy_->SetDefaultSigningKey();
@@ -1419,7 +1419,7 @@
em::LoginAuthenticationBehaviorProto_LoginBehavior_SAML_INTERSTITIAL);
base::RunLoop run_loop;
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(kLoginAuthenticationBehavior,
run_loop.QuitClosure());
device_policy_->SetDefaultSigningKey();
@@ -1436,7 +1436,7 @@
proto.mutable_login_video_capture_allowed_urls()->add_urls(url.spec());
base::RunLoop run_loop;
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(kLoginVideoCaptureAllowedUrls,
run_loop.QuitClosure());
device_policy_->SetDefaultSigningKey();
diff --git a/chrome/browser/chromeos/login/screens/error_screen.cc b/chrome/browser/chromeos/login/screens/error_screen.cc
index ba70537..2940f51 100644
--- a/chrome/browser/chromeos/login/screens/error_screen.cc
+++ b/chrome/browser/chromeos/login/screens/error_screen.cc
@@ -172,8 +172,8 @@
view_->SetIsPersistentError(is_persistent);
}
-ErrorScreen::ConnectRequestCallbackSubscription
-ErrorScreen::RegisterConnectRequestCallback(const base::Closure& callback) {
+base::CallbackListSubscription ErrorScreen::RegisterConnectRequestCallback(
+ const base::Closure& callback) {
return connect_request_callbacks_.Add(callback);
}
diff --git a/chrome/browser/chromeos/login/screens/error_screen.h b/chrome/browser/chromeos/login/screens/error_screen.h
index db97d11..f2d8e71 100644
--- a/chrome/browser/chromeos/login/screens/error_screen.h
+++ b/chrome/browser/chromeos/login/screens/error_screen.h
@@ -29,9 +29,6 @@
public LoginPerformer::Delegate,
public NetworkConnectionObserver {
public:
- using ConnectRequestCallbackSubscription =
- std::unique_ptr<base::CallbackList<void()>::Subscription>;
-
// TODO(jdufault): Some of these are no longer used and can be removed. See
// crbug.com/672142.
static const char kUserActionConfigureCertsButtonClicked[];
@@ -99,7 +96,7 @@
// Register a callback to be invoked when the user indicates that an attempt
// to connect to the network should be made.
- ConnectRequestCallbackSubscription RegisterConnectRequestCallback(
+ base::CallbackListSubscription RegisterConnectRequestCallback(
const base::Closure& callback);
// Creates an instance of CaptivePortalWindowProxy, if one has not already
diff --git a/chrome/browser/chromeos/login/screens/update_required_screen.cc b/chrome/browser/chromeos/login/screens/update_required_screen.cc
index 2b3e9ca..f635829 100644
--- a/chrome/browser/chromeos/login/screens/update_required_screen.cc
+++ b/chrome/browser/chromeos/login/screens/update_required_screen.cc
@@ -284,7 +284,7 @@
error_message_timer_.Stop();
error_screen_->HideCaptivePortal();
- connect_request_subscription_.reset();
+ connect_request_subscription_ = {};
if (version_updater_->update_info().state ==
VersionUpdater::State::STATE_ERROR)
HideErrorMessage();
diff --git a/chrome/browser/chromeos/login/screens/update_required_screen.h b/chrome/browser/chromeos/login/screens/update_required_screen.h
index 8d3b8bf..aa0843f 100644
--- a/chrome/browser/chromeos/login/screens/update_required_screen.h
+++ b/chrome/browser/chromeos/login/screens/update_required_screen.h
@@ -144,10 +144,9 @@
base::TimeDelta error_message_delay_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- eol_message_subscription_;
+ base::CallbackListSubscription eol_message_subscription_;
- ErrorScreen::ConnectRequestCallbackSubscription connect_request_subscription_;
+ base::CallbackListSubscription connect_request_subscription_;
base::WeakPtrFactory<UpdateRequiredScreen> weak_factory_{this};
diff --git a/chrome/browser/chromeos/login/screens/update_screen.cc b/chrome/browser/chromeos/login/screens/update_screen.cc
index 4b3e32b..e884f713 100644
--- a/chrome/browser/chromeos/login/screens/update_screen.cc
+++ b/chrome/browser/chromeos/login/screens/update_screen.cc
@@ -236,7 +236,7 @@
error_message_timer_.Stop();
error_screen_->HideCaptivePortal();
- connect_request_subscription_.reset();
+ connect_request_subscription_ = {};
if (version_updater_->update_info().state ==
VersionUpdater::State::STATE_ERROR)
HideErrorMessage();
diff --git a/chrome/browser/chromeos/login/screens/update_screen.h b/chrome/browser/chromeos/login/screens/update_screen.h
index b85fec9..82d36445 100644
--- a/chrome/browser/chromeos/login/screens/update_screen.h
+++ b/chrome/browser/chromeos/login/screens/update_screen.h
@@ -219,7 +219,7 @@
base::TimeDelta verify_time_;
base::TimeDelta finalize_time_;
- ErrorScreen::ConnectRequestCallbackSubscription connect_request_subscription_;
+ base::CallbackListSubscription connect_request_subscription_;
// PowerManagerClient::Observer is used only when screen is shown.
std::unique_ptr<
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.h b/chrome/browser/chromeos/login/screens/user_selection_screen.h
index 48da66a0..bcf2aff 100644
--- a/chrome/browser/chromeos/login/screens/user_selection_screen.h
+++ b/chrome/browser/chromeos/login/screens/user_selection_screen.h
@@ -203,8 +203,7 @@
// Input Method Engine state used at the user selection screen.
scoped_refptr<input_method::InputMethodManager::State> ime_state_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- allowed_input_methods_subscription_;
+ base::CallbackListSubscription allowed_input_methods_subscription_;
// Collection of verifiers that check validity of password sync token for SAML
// users corresponding to visible pods.
diff --git a/chrome/browser/chromeos/login/signin/token_handle_fetcher.cc b/chrome/browser/chromeos/login/signin/token_handle_fetcher.cc
index a751165..d7b95558 100644
--- a/chrome/browser/chromeos/login/signin/token_handle_fetcher.cc
+++ b/chrome/browser/chromeos/login/signin/token_handle_fetcher.cc
@@ -63,7 +63,7 @@
if (!identity_manager_->HasAccountWithRefreshToken(
identity_manager_->GetPrimaryAccountId(
signin::ConsentLevel::kNotRequired))) {
- profile_shutdown_notification_ =
+ profile_shutdown_subscription_ =
TokenHandleFetcherShutdownNotifierFactory::GetInstance()
->Get(profile)
->Subscribe(base::Bind(&TokenHandleFetcher::OnProfileDestroyed,
diff --git a/chrome/browser/chromeos/login/signin/token_handle_fetcher.h b/chrome/browser/chromeos/login/signin/token_handle_fetcher.h
index 9ff3cbc1..02656e7 100644
--- a/chrome/browser/chromeos/login/signin/token_handle_fetcher.h
+++ b/chrome/browser/chromeos/login/signin/token_handle_fetcher.h
@@ -70,8 +70,7 @@
std::unique_ptr<gaia::GaiaOAuthClient> gaia_client_;
std::unique_ptr<signin::PrimaryAccountAccessTokenFetcher>
access_token_fetcher_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- profile_shutdown_notification_;
+ base::CallbackListSubscription profile_shutdown_subscription_;
DISALLOW_COPY_AND_ASSIGN(TokenHandleFetcher);
};
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
index 20dcd3e6..f3021ef3 100644
--- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -406,7 +406,7 @@
GetMinimumVersionPolicyHandler()->RemoveObserver(this);
}
- local_accounts_subscription_.reset();
+ local_accounts_subscription_ = {};
if (session_length_limiter_ && IsEnterpriseManaged()) {
// Store session length before tearing down `session_length_limiter_` for
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h
index 87b8e91..aff78c79 100644
--- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h
+++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h
@@ -264,11 +264,10 @@
FlowMap specific_flows_;
// Cros settings change subscriptions.
- std::unique_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription> users_subscription_;
+ base::CallbackListSubscription allow_guest_subscription_;
+ base::CallbackListSubscription users_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- local_accounts_subscription_;
+ base::CallbackListSubscription local_accounts_subscription_;
std::unique_ptr<MultiProfileUserController> multi_profile_user_controller_;
diff --git a/chrome/browser/chromeos/login/version_info_updater.h b/chrome/browser/chromeos/login/version_info_updater.h
index 999f928..1129c33 100644
--- a/chrome/browser/chromeos/login/version_info_updater.h
+++ b/chrome/browser/chromeos/login/version_info_updater.h
@@ -91,8 +91,7 @@
// Text obtained from OnVersion.
std::string version_text_;
- std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>>
- subscriptions_;
+ std::vector<base::CallbackListSubscription> subscriptions_;
chromeos::CrosSettings* cros_settings_;
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 2b2d52c..4efd3e0 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -1839,7 +1839,7 @@
const AccessibilityStatusEventDetails& details) {
enum AccessibilityNotificationType type = details.notification_type;
if (type == ACCESSIBILITY_MANAGER_SHUTDOWN) {
- accessibility_subscription_.reset();
+ accessibility_subscription_ = {};
return;
} else if (type != ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK || !details.enabled) {
return;
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 3d2c75e..1cb51769 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -469,7 +469,7 @@
friend class WizardControllerScreenPriorityTest;
friend class WizardControllerSupervisionTransitionOobeTest;
- std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
std::unique_ptr<SimpleGeolocationProvider> geolocation_provider_;
std::unique_ptr<TimeZoneProvider> timezone_provider_;
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index 082591c..06eaa0c 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -1070,12 +1070,10 @@
static void WaitForAutoEnrollmentState(policy::AutoEnrollmentState state) {
base::RunLoop loop;
- std::unique_ptr<
- AutoEnrollmentController::ProgressCallbackList::Subscription>
- progress_subscription(
- auto_enrollment_controller()->RegisterProgressCallback(
- base::BindRepeating(&QuitLoopOnAutoEnrollmentProgress, state,
- &loop)));
+ base::CallbackListSubscription progress_subscription =
+ auto_enrollment_controller()->RegisterProgressCallback(
+ base::BindRepeating(&QuitLoopOnAutoEnrollmentProgress, state,
+ &loop));
loop.Run();
}
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
index 6c5a7cb..2a81ce1 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
@@ -50,8 +50,7 @@
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
sync_sessions::SessionSyncService* session_sync_service_;
std::unique_ptr<BrowserTabsMetadataFetcher> browser_tabs_metadata_fetcher_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- session_updated_subscription_;
+ base::CallbackListSubscription session_updated_subscription_;
base::WeakPtrFactory<BrowserTabsModelProviderImpl> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl_unittest.cc b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl_unittest.cc
index 1ae5ce8..e5328e3 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl_unittest.cc
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl_unittest.cc
@@ -32,9 +32,9 @@
MOCK_CONST_METHOD0(GetGlobalIdMapper, syncer::GlobalIdMapper*());
MOCK_METHOD0(GetOpenTabsUIDelegate, sync_sessions::OpenTabsUIDelegate*());
- MOCK_METHOD1(SubscribeToForeignSessionsChanged,
- std::unique_ptr<base::CallbackList<void()>::Subscription>(
- const base::RepeatingClosure& cb));
+ MOCK_METHOD1(
+ SubscribeToForeignSessionsChanged,
+ base::CallbackListSubscription(const base::RepeatingClosure& cb));
MOCK_METHOD0(ScheduleGarbageCollection, void());
MOCK_METHOD0(GetControllerDelegate,
base::WeakPtr<syncer::ModelTypeControllerDelegate>());
@@ -130,10 +130,10 @@
CreatePhoneDevice(/*pii_name=*/pii_free_name)));
}
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- MockSubscribeToForeignSessionsChanged(const base::RepeatingClosure& cb) {
+ base::CallbackListSubscription MockSubscribeToForeignSessionsChanged(
+ const base::RepeatingClosure& cb) {
foreign_sessions_changed_callback_ = std::move(cb);
- return nullptr;
+ return {};
}
bool MockGetAllForeignSessions(
diff --git a/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h b/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h
index 35d9f25..0de85302 100644
--- a/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h
+++ b/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h
@@ -119,12 +119,9 @@
PluginVmAllowedChanged callback_;
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- device_allowed_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- license_subscription_;
- std::unique_ptr<base::CallbackList<void(void)>::Subscription>
- fake_license_subscription_;
+ base::CallbackListSubscription device_allowed_subscription_;
+ base::CallbackListSubscription license_subscription_;
+ base::CallbackListSubscription fake_license_subscription_;
};
} // namespace plugin_vm
diff --git a/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.h b/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.h
index fa39a84c..1a32ab1 100644
--- a/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.h
+++ b/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.h
@@ -98,8 +98,7 @@
std::unique_ptr<base::OneShotTimer> notification_timer_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- policy_subscription_;
+ base::CallbackListSubscription policy_subscription_;
CheckSideloadingStatusCallback check_sideloading_status_callback_;
diff --git a/chrome/browser/chromeos/policy/bluetooth_policy_handler.h b/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
index 5520653d8..623c3befa 100644
--- a/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
+++ b/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
@@ -35,8 +35,7 @@
void SetBluetoothPolicy(scoped_refptr<device::BluetoothAdapter> adapter);
chromeos::CrosSettings* cros_settings_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- bluetooth_policy_subscription_;
+ base::CallbackListSubscription bluetooth_policy_subscription_;
scoped_refptr<device::BluetoothAdapter> adapter_;
base::WeakPtrFactory<BluetoothPolicyHandler> weak_factory_{this};
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h
index 772b3489..1fda22f8 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h
+++ b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h
@@ -115,8 +115,7 @@
Delegate* delegate_;
content::NotificationRegistrar notification_registrar_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- device_local_accounts_subscription_;
+ base::CallbackListSubscription device_local_accounts_subscription_;
// A map from user ID to a base::WeakPtr for each external data fetch
// currently in progress. This allows fetches to be effectively be canceled by
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
index 24a55b9..c2df87c8 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
@@ -114,7 +114,7 @@
policy_store_->RemoveObserver(this);
enrollment_handler_.reset();
- state_keys_update_subscription_.reset();
+ state_keys_update_subscription_ = {};
is_initialized_ = false;
}
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.h b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.h
index fafa409..3fcdd62 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.h
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.h
@@ -169,7 +169,7 @@
// Non-NULL if there is an enrollment operation pending.
std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_;
- ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_;
+ base::CallbackListSubscription state_keys_update_subscription_;
// Our signing service.
std::unique_ptr<SigningService> signing_service_;
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
index d66cdb5..a531fe2 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
@@ -123,7 +123,7 @@
syslog_uploader_.reset();
status_uploader_.reset();
external_data_manager_->Disconnect();
- state_keys_update_subscription_.reset();
+ state_keys_update_subscription_ = {};
CloudPolicyManager::Shutdown();
signin_profile_forwarding_schema_registry_.reset();
}
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
index a79c8de..a0ebce49 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
@@ -181,7 +181,7 @@
// The TaskRunner used to do device status and log uploads.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_;
+ base::CallbackListSubscription state_keys_update_subscription_;
// PrefService instance to read the policy refresh rate from.
PrefService* local_state_;
diff --git a/chrome/browser/chromeos/policy/device_dock_mac_address_source_handler.h b/chrome/browser/chromeos/policy/device_dock_mac_address_source_handler.h
index 08effbe..6683aa2 100644
--- a/chrome/browser/chromeos/policy/device_dock_mac_address_source_handler.h
+++ b/chrome/browser/chromeos/policy/device_dock_mac_address_source_handler.h
@@ -31,8 +31,7 @@
chromeos::CrosSettings* cros_settings_;
chromeos::NetworkDeviceHandler* network_device_handler_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- dock_mac_address_source_policy_subscription_;
+ base::CallbackListSubscription dock_mac_address_source_policy_subscription_;
base::WeakPtrFactory<DeviceDockMacAddressHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DeviceDockMacAddressHandler);
diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_service.h b/chrome/browser/chromeos/policy/device_local_account_policy_service.h
index ece9cbdb..0abe7d6 100644
--- a/chrome/browser/chromeos/policy/device_local_account_policy_service.h
+++ b/chrome/browser/chromeos/policy/device_local_account_policy_service.h
@@ -271,8 +271,7 @@
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
- const std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- local_accounts_subscription_;
+ const base::CallbackListSubscription local_accounts_subscription_;
// Path to the directory that contains the cached policy for components
// for device-local accounts.
diff --git a/chrome/browser/chromeos/policy/device_network_configuration_updater.h b/chrome/browser/chromeos/policy/device_network_configuration_updater.h
index 783c837..0af76221 100644
--- a/chrome/browser/chromeos/policy/device_network_configuration_updater.h
+++ b/chrome/browser/chromeos/policy/device_network_configuration_updater.h
@@ -73,8 +73,7 @@
chromeos::NetworkDeviceHandler* network_device_handler_;
chromeos::CrosSettings* cros_settings_;
- std::unique_ptr<base::CallbackList<void(void)>::Subscription>
- data_roaming_setting_subscription_;
+ base::CallbackListSubscription data_roaming_setting_subscription_;
// Returns the device's administrator-set asset id.
DeviceAssetIDFetcher device_asset_id_fetcher_;
diff --git a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
index 1c07807..107bf7b 100644
--- a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
+++ b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
@@ -167,11 +167,10 @@
base::RunLoop run_loop;
// For calls from SetPolicy().
- std::vector<std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>>
- observers = {};
+ std::vector<base::CallbackListSubscription> subscriptions = {};
for (auto setting_it = settings.cbegin(); setting_it != settings.cend();
setting_it++) {
- observers.push_back(chromeos::CrosSettings::Get()->AddSettingsObserver(
+ subscriptions.push_back(chromeos::CrosSettings::Get()->AddSettingsObserver(
*setting_it, run_loop.QuitClosure()));
}
RefreshDevicePolicy();
diff --git a/chrome/browser/chromeos/policy/device_quirks_policy_browsertest.cc b/chrome/browser/chromeos/policy/device_quirks_policy_browsertest.cc
index 7e2930e..35791bed 100644
--- a/chrome/browser/chromeos/policy/device_quirks_policy_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_quirks_policy_browsertest.cc
@@ -46,7 +46,7 @@
protected:
void RefreshPolicyAndWaitDeviceSettingsUpdated() {
base::RunLoop run_loop;
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(
kDeviceQuirksDownloadEnabled, run_loop.QuitWhenIdleClosure());
diff --git a/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc b/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc
index 55bb175..4810713 100644
--- a/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc
@@ -53,7 +53,7 @@
protected:
void RefreshPolicyAndWaitDeviceSettingsUpdated() {
base::RunLoop run_loop;
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(
kSystemUse24HourClock, run_loop.QuitWhenIdleClosure());
diff --git a/chrome/browser/chromeos/policy/device_wifi_allowed_handler.h b/chrome/browser/chromeos/policy/device_wifi_allowed_handler.h
index 19d508a9..d1ca3a9 100644
--- a/chrome/browser/chromeos/policy/device_wifi_allowed_handler.h
+++ b/chrome/browser/chromeos/policy/device_wifi_allowed_handler.h
@@ -25,8 +25,7 @@
void OnWiFiPolicyChanged();
chromeos::CrosSettings* cros_settings_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- wifi_policy_subscription_;
+ base::CallbackListSubscription wifi_policy_subscription_;
base::WeakPtrFactory<DeviceWiFiAllowedHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DeviceWiFiAllowedHandler);
diff --git a/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
index aa27b4e..815c3806 100644
--- a/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
+++ b/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
@@ -342,7 +342,7 @@
em::ChromeDeviceSettingsProto& proto(device_policy->payload());
SetPolicyValue(&proto, policy_value, true);
base::RunLoop run_loop;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kDeviceDisplayResolution, run_loop.QuitClosure());
device_policy->SetDefaultSigningKey();
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
index 1be9ed7..192f997b 100644
--- a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
+++ b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
@@ -215,7 +215,7 @@
proto.mutable_display_rotation_default()->set_display_rotation_default(
static_cast<em::DisplayRotationDefaultProto::Rotation>(policy_rotation));
base::RunLoop run_loop;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kDisplayRotationDefault, run_loop.QuitClosure());
device_policy->SetDefaultSigningKey();
diff --git a/chrome/browser/chromeos/policy/display_settings_handler.cc b/chrome/browser/chromeos/policy/display_settings_handler.cc
index 0ae7750a..a437d69 100644
--- a/chrome/browser/chromeos/policy/display_settings_handler.cc
+++ b/chrome/browser/chromeos/policy/display_settings_handler.cc
@@ -44,7 +44,7 @@
// Register observers for all settings
for (const auto& handler : handlers_) {
- settings_observers_.push_back(
+ settings_subscriptions_.push_back(
chromeos::CrosSettings::Get()->AddSettingsObserver(
handler->SettingName(),
base::BindRepeating(&DisplaySettingsHandler::OnSettingUpdate,
diff --git a/chrome/browser/chromeos/policy/display_settings_handler.h b/chrome/browser/chromeos/policy/display_settings_handler.h
index 5c03883d..df37d62c 100644
--- a/chrome/browser/chromeos/policy/display_settings_handler.h
+++ b/chrome/browser/chromeos/policy/display_settings_handler.h
@@ -99,8 +99,7 @@
std::vector<std::unique_ptr<DisplaySettingsPolicyHandler>> handlers_;
mojo::AssociatedReceiver<ash::mojom::CrosDisplayConfigObserver>
cros_display_config_observer_receiver_{this};
- std::vector<std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>>
- settings_observers_;
+ std::vector<base::CallbackListSubscription> settings_subscriptions_;
bool started_ = false;
// Must be the last member.
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler.cc b/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
index 0525f34..fc941b2 100644
--- a/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
+++ b/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
@@ -196,13 +196,13 @@
if (!gcm_driver_)
return;
- heartbeat_frequency_observer_ =
+ heartbeat_frequency_subscription_ =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kHeartbeatFrequency,
base::Bind(&HeartbeatScheduler::RefreshHeartbeatSettings,
base::Unretained(this)));
- heartbeat_enabled_observer_ =
+ heartbeat_enabled_subscription_ =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kHeartbeatEnabled,
base::Bind(&HeartbeatScheduler::RefreshHeartbeatSettings,
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler.h b/chrome/browser/chromeos/policy/heartbeat_scheduler.h
index 33026fdb..9a46e6d0 100644
--- a/chrome/browser/chromeos/policy/heartbeat_scheduler.h
+++ b/chrome/browser/chromeos/policy/heartbeat_scheduler.h
@@ -129,11 +129,9 @@
// Cached copy of the current heartbeat interval, in milliseconds.
base::TimeDelta heartbeat_interval_;
- // Observers to changes in the heartbeat settings.
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- heartbeat_frequency_observer_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- heartbeat_enabled_observer_;
+ // Subscriptions for callbacks for changes in the heartbeat settings.
+ base::CallbackListSubscription heartbeat_frequency_subscription_;
+ base::CallbackListSubscription heartbeat_enabled_subscription_;
// The time the last heartbeat was sent.
base::Time last_heartbeat_;
diff --git a/chrome/browser/chromeos/policy/hostname_handler.h b/chrome/browser/chromeos/policy/hostname_handler.h
index eadec7b..a0a8763f3 100644
--- a/chrome/browser/chromeos/policy/hostname_handler.h
+++ b/chrome/browser/chromeos/policy/hostname_handler.h
@@ -51,8 +51,7 @@
void OnDeviceHostnamePropertyChangedAndMachineStatisticsLoaded();
chromeos::CrosSettings* cros_settings_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- policy_subscription_;
+ base::CallbackListSubscription policy_subscription_;
std::string hostname_;
base::WeakPtrFactory<HostnameHandler> weak_factory_{this};
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
index 7843b51..015fd3a3 100644
--- a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
+++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
@@ -301,8 +301,7 @@
base::OnceClosure fetch_eol_callback_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- policy_subscription_;
+ base::CallbackListSubscription policy_subscription_;
// Handles showing in-session update required notifications on the basis of
// current network and time to reach the deadline.
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
index e4646744..b983879 100644
--- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
+++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
@@ -259,7 +259,7 @@
} // namespace update_checker_internal
-// |cros_settings_observer_| will be destroyed as part of this object
+// |cros_settings_subscription_| will be destroyed as part of this object
// guaranteeing to not run |OnScheduledUpdateCheckDataChanged| after its
// destruction. Therefore, it's safe to use "this" while adding this observer.
// Similarly, |start_update_check_timer_task_executor_| and
@@ -269,7 +269,7 @@
chromeos::CrosSettings* cros_settings,
chromeos::NetworkStateHandler* network_state_handler)
: cros_settings_(cros_settings),
- cros_settings_observer_(cros_settings_->AddSettingsObserver(
+ cros_settings_subscription_(cros_settings_->AddSettingsObserver(
chromeos::kDeviceScheduledUpdateCheck,
base::BindRepeating(
&DeviceScheduledUpdateChecker::OnScheduledUpdateCheckDataChanged,
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
index 8fa04b5..dbf2f63 100644
--- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
+++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
@@ -129,9 +129,8 @@
// Used to retrieve Chrome OS settings. Not owned.
chromeos::CrosSettings* const cros_settings_;
- // Used to observe when settings change.
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- cros_settings_observer_;
+ // Subscription for callback when settings change.
+ base::CallbackListSubscription cros_settings_subscription_;
// Currently active scheduled update check policy.
base::Optional<ScheduledUpdateCheckData> scheduled_update_check_data_;
diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc
index ada95496..b483cb0ff 100644
--- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc
+++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc
@@ -30,7 +30,7 @@
ServerBackedStateKeysBroker::~ServerBackedStateKeysBroker() {
}
-ServerBackedStateKeysBroker::Subscription
+base::CallbackListSubscription
ServerBackedStateKeysBroker::RegisterUpdateCallback(
const UpdateCallback& callback) {
if (!available())
diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h
index b25e59c..69635e7 100644
--- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h
+++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h
@@ -27,7 +27,6 @@
public:
using UpdateCallbackList = base::RepeatingClosureList;
using UpdateCallback = UpdateCallbackList::CallbackType;
- using Subscription = std::unique_ptr<UpdateCallbackList::Subscription>;
using StateKeysCallbackList =
base::OnceCallbackList<void(const std::vector<std::string>&)>;
using StateKeysCallback = StateKeysCallbackList::CallbackType;
@@ -37,10 +36,11 @@
~ServerBackedStateKeysBroker();
// Registers a callback to be invoked whenever the state keys get updated.
- // Note that consuming code needs to hold on to the returned Subscription as
+ // Note that consuming code needs to hold on to the returned subscription as
// long as it wants to receive the callback. If the state keys haven't been
// requested yet, calling this will also trigger their initial fetch.
- Subscription RegisterUpdateCallback(const UpdateCallback& callback);
+ base::CallbackListSubscription RegisterUpdateCallback(
+ const UpdateCallback& callback);
// Requests state keys asynchronously. Invokes the passed callback at most
// once, with the current state keys passed as a parameter to the callback. If
diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc
index f1ec2c3..09d324b 100644
--- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc
+++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc
@@ -62,10 +62,9 @@
EXPECT_TRUE(broker_.state_keys().empty());
EXPECT_TRUE(broker_.current_state_key().empty());
- ServerBackedStateKeysBroker::Subscription subscription =
- broker_.RegisterUpdateCallback(
- base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
- base::Unretained(this)));
+ base::CallbackListSubscription subscription = broker_.RegisterUpdateCallback(
+ base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
+ base::Unretained(this)));
mocked_main_runner_->RunUntilIdle();
EXPECT_TRUE(updated_);
ExpectGood();
@@ -75,10 +74,9 @@
fake_session_manager_client_.set_server_backed_state_keys(
std::vector<std::string>());
- ServerBackedStateKeysBroker::Subscription subscription =
- broker_.RegisterUpdateCallback(
- base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
- base::Unretained(this)));
+ base::CallbackListSubscription subscription = broker_.RegisterUpdateCallback(
+ base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
+ base::Unretained(this)));
mocked_main_runner_->RunUntilIdle();
EXPECT_TRUE(updated_);
@@ -88,7 +86,7 @@
fake_session_manager_client_.set_server_backed_state_keys(state_keys_);
updated_ = false;
- ServerBackedStateKeysBroker::Subscription subscription2 =
+ base::CallbackListSubscription subscription2 =
broker_.RegisterUpdateCallback(base::DoNothing());
mocked_main_runner_->RunUntilIdle();
EXPECT_TRUE(updated_);
@@ -96,10 +94,9 @@
}
TEST_F(ServerBackedStateKeysBrokerTest, Refresh) {
- ServerBackedStateKeysBroker::Subscription subscription =
- broker_.RegisterUpdateCallback(
- base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
- base::Unretained(this)));
+ base::CallbackListSubscription subscription = broker_.RegisterUpdateCallback(
+ base::Bind(&ServerBackedStateKeysBrokerTest::StateKeysUpdated,
+ base::Unretained(this)));
mocked_main_runner_->RunUntilIdle();
EXPECT_TRUE(updated_);
ExpectGood();
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
index 5cbd59e..61cf9b9 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
@@ -457,50 +457,28 @@
bool report_system_info_ = false;
bool stat_reporting_pref_ = false;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- activity_times_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- network_interfaces_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- users_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- hardware_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- session_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- os_update_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- running_kiosk_app_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- power_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- storage_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- board_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- cpu_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- graphics_status_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- timezone_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- memory_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- backlight_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- crash_report_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- bluetooth_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- fan_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- vpd_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- system_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- app_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- stats_reporting_pref_subscription_;
+ base::CallbackListSubscription activity_times_subscription_;
+ base::CallbackListSubscription network_interfaces_subscription_;
+ base::CallbackListSubscription users_subscription_;
+ base::CallbackListSubscription hardware_status_subscription_;
+ base::CallbackListSubscription session_status_subscription_;
+ base::CallbackListSubscription os_update_status_subscription_;
+ base::CallbackListSubscription running_kiosk_app_subscription_;
+ base::CallbackListSubscription power_status_subscription_;
+ base::CallbackListSubscription storage_status_subscription_;
+ base::CallbackListSubscription board_status_subscription_;
+ base::CallbackListSubscription cpu_info_subscription_;
+ base::CallbackListSubscription graphics_status_subscription_;
+ base::CallbackListSubscription timezone_info_subscription_;
+ base::CallbackListSubscription memory_info_subscription_;
+ base::CallbackListSubscription backlight_info_subscription_;
+ base::CallbackListSubscription crash_report_info_subscription_;
+ base::CallbackListSubscription bluetooth_info_subscription_;
+ base::CallbackListSubscription fan_info_subscription_;
+ base::CallbackListSubscription vpd_info_subscription_;
+ base::CallbackListSubscription system_info_subscription_;
+ base::CallbackListSubscription app_info_subscription_;
+ base::CallbackListSubscription stats_reporting_pref_subscription_;
AffiliatedSessionService affiliated_session_service_;
diff --git a/chrome/browser/chromeos/policy/status_collector/status_collector.h b/chrome/browser/chromeos/policy/status_collector/status_collector.h
index cb55ac7..b85a664 100644
--- a/chrome/browser/chromeos/policy/status_collector/status_collector.h
+++ b/chrome/browser/chromeos/policy/status_collector/status_collector.h
@@ -136,10 +136,8 @@
bool report_activity_times_ = false;
bool report_boot_mode_ = false;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- version_info_subscription_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- boot_mode_subscription_;
+ base::CallbackListSubscription version_info_subscription_;
+ base::CallbackListSubscription boot_mode_subscription_;
base::Clock* clock_;
diff --git a/chrome/browser/chromeos/policy/status_uploader.cc b/chrome/browser/chromeos/policy/status_uploader.cc
index 404ae21..8ef3790 100644
--- a/chrome/browser/chromeos/policy/status_uploader.cc
+++ b/chrome/browser/chromeos/policy/status_uploader.cc
@@ -54,7 +54,7 @@
MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
// Listen for changes to the upload delay, and start sending updates to the
// server.
- upload_frequency_observer_ =
+ upload_frequency_subscription_ =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kReportUploadFrequency,
base::Bind(&StatusUploader::RefreshUploadFrequency,
diff --git a/chrome/browser/chromeos/policy/status_uploader.h b/chrome/browser/chromeos/policy/status_uploader.h
index 9f42e849..3798f4a 100644
--- a/chrome/browser/chromeos/policy/status_uploader.h
+++ b/chrome/browser/chromeos/policy/status_uploader.h
@@ -96,9 +96,8 @@
// How long to wait between status uploads.
base::TimeDelta upload_frequency_;
- // Observer to changes in the upload frequency.
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- upload_frequency_observer_;
+ // Subscription for the callback about changes in the upload frequency.
+ base::CallbackListSubscription upload_frequency_subscription_;
// The time the last upload was performed.
base::Time last_upload_;
diff --git a/chrome/browser/chromeos/policy/system_log_uploader.cc b/chrome/browser/chromeos/policy/system_log_uploader.cc
index bff3e56..27bd30e 100644
--- a/chrome/browser/chromeos/policy/system_log_uploader.cc
+++ b/chrome/browser/chromeos/policy/system_log_uploader.cc
@@ -333,10 +333,11 @@
SYSLOG(INFO) << "Creating system log uploader.";
// Watch for policy changes.
- upload_enabled_observer_ = chromeos::CrosSettings::Get()->AddSettingsObserver(
- chromeos::kSystemLogUploadEnabled,
- base::Bind(&SystemLogUploader::RefreshUploadSettings,
- base::Unretained(this)));
+ upload_enabled_subscription_ =
+ chromeos::CrosSettings::Get()->AddSettingsObserver(
+ chromeos::kSystemLogUploadEnabled,
+ base::Bind(&SystemLogUploader::RefreshUploadSettings,
+ base::Unretained(this)));
// Fetch the current value of the policy.
RefreshUploadSettings();
diff --git a/chrome/browser/chromeos/policy/system_log_uploader.h b/chrome/browser/chromeos/policy/system_log_uploader.h
index 0d37429..33d1ad1 100644
--- a/chrome/browser/chromeos/policy/system_log_uploader.h
+++ b/chrome/browser/chromeos/policy/system_log_uploader.h
@@ -180,9 +180,8 @@
// use the last-known trusted values.
bool upload_enabled_;
- // Observer to changes in system log upload settings.
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- upload_enabled_observer_;
+ // Subscription for callback on changes in system log upload settings.
+ base::CallbackListSubscription upload_enabled_subscription_;
base::ThreadChecker thread_checker_;
diff --git a/chrome/browser/chromeos/policy/system_proxy_manager.h b/chrome/browser/chromeos/policy/system_proxy_manager.h
index d95a4ea..dbde688 100644
--- a/chrome/browser/chromeos/policy/system_proxy_manager.h
+++ b/chrome/browser/chromeos/policy/system_proxy_manager.h
@@ -172,8 +172,7 @@
void CloseAuthenticationUI();
chromeos::CrosSettings* cros_settings_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- system_proxy_subscription_;
+ base::CallbackListSubscription system_proxy_subscription_;
bool system_proxy_enabled_ = false;
// The authority URI in the format host:port of the local proxy worker for
diff --git a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h
index ed039de..40021a79 100644
--- a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h
+++ b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h
@@ -102,8 +102,7 @@
std::unique_ptr<base::OneShotTimer> notification_timer_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- policy_subscription_;
+ base::CallbackListSubscription policy_subscription_;
UpdateCheckerCallback update_checker_callback_;
diff --git a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc
index 7c34000..a98f085 100644
--- a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc
+++ b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc
@@ -100,7 +100,7 @@
void RefreshPolicyAndWaitUntilDeviceSettingsUpdated() {
base::RunLoop run_loop;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
+ base::CallbackListSubscription subscription =
chromeos::CrosSettings::Get()->AddSettingsObserver(
chromeos::kUnaffiliatedArcAllowed, run_loop.QuitClosure());
RefreshDevicePolicy();
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
index 04dc2625..bd8137c 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -818,7 +818,7 @@
invalidation_provider->GetInvalidationServiceForCustomSender(
policy::kPolicyFCMInvalidationSenderID));
- shutdown_notifier_ =
+ shutdown_subscription_ =
UserCloudPolicyManagerChromeOSNotifierFactory::GetInstance()
->Get(profile_)
->Subscribe(base::AdaptCallbackForRepeating(
@@ -830,7 +830,7 @@
// Unregister the RemoteCommandsInvalidatorImpl from the InvalidatorRegistrar.
invalidator_->Shutdown();
invalidator_.reset();
- shutdown_notifier_.reset();
+ shutdown_subscription_ = {};
}
void UserCloudPolicyManagerChromeOS::SetUserContextRefreshTokenForTests(
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
index 0eb2f9d..b67ed99 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
@@ -321,8 +321,7 @@
std::unique_ptr<RemoteCommandsInvalidator> invalidator_;
// Listening to notification that profile is destroyed.
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_subscription_;
// The SharedURLLoaderFactory used in some tests to simulate network requests.
scoped_refptr<network::SharedURLLoaderFactory>
diff --git a/chrome/browser/chromeos/printing/calculators_policies_binder.cc b/chrome/browser/chromeos/printing/calculators_policies_binder.cc
index a2286b10..d0e2894 100644
--- a/chrome/browser/chromeos/printing/calculators_policies_binder.cc
+++ b/chrome/browser/chromeos/printing/calculators_policies_binder.cc
@@ -117,7 +117,7 @@
private:
CrosSettings* settings_;
- std::list<std::unique_ptr<CrosSettings::ObserverSubscription>> subscriptions_;
+ std::list<base::CallbackListSubscription> subscriptions_;
};
} // namespace
diff --git a/chrome/browser/chromeos/settings/cros_settings.cc b/chrome/browser/chromeos/settings/cros_settings.cc
index 4f6e84f9..933cb34 100644
--- a/chrome/browser/chromeos/settings/cros_settings.cc
+++ b/chrome/browser/chromeos/settings/cros_settings.cc
@@ -294,18 +294,13 @@
return nullptr;
}
-std::unique_ptr<CrosSettings::ObserverSubscription>
-CrosSettings::AddSettingsObserver(const std::string& path,
- base::RepeatingClosure callback) {
+base::CallbackListSubscription CrosSettings::AddSettingsObserver(
+ const std::string& path,
+ base::RepeatingClosure callback) {
DCHECK(!path.empty());
DCHECK(callback);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-
- if (!GetProvider(path)) {
- NOTREACHED() << "Trying to add an observer for an unregistered setting: "
- << path;
- return std::unique_ptr<CrosSettings::ObserverSubscription>();
- }
+ DCHECK(GetProvider(path));
// Get the callback registry associated with the path.
base::CallbackList<void(void)>* registry = nullptr;
diff --git a/chrome/browser/chromeos/settings/cros_settings.h b/chrome/browser/chromeos/settings/cros_settings.h
index b6c07ad..b58ece5 100644
--- a/chrome/browser/chromeos/settings/cros_settings.h
+++ b/chrome/browser/chromeos/settings/cros_settings.h
@@ -120,8 +120,7 @@
CrosSettingsProvider* provider);
// Add an observer Callback for changes for the given |path|.
- using ObserverSubscription = base::CallbackList<void(void)>::Subscription;
- std::unique_ptr<ObserverSubscription> AddSettingsObserver(
+ base::CallbackListSubscription AddSettingsObserver(
const std::string& path,
base::RepeatingClosure callback) WARN_UNUSED_RESULT;
diff --git a/chrome/browser/chromeos/settings/shutdown_policy_handler.h b/chrome/browser/chromeos/settings/shutdown_policy_handler.h
index 51bd3ca..12a2736 100644
--- a/chrome/browser/chromeos/settings/shutdown_policy_handler.h
+++ b/chrome/browser/chromeos/settings/shutdown_policy_handler.h
@@ -41,8 +41,7 @@
Delegate* delegate_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- shutdown_policy_subscription_;
+ base::CallbackListSubscription shutdown_policy_subscription_;
base::WeakPtrFactory<ShutdownPolicyHandler> weak_factory_{this};
diff --git a/chrome/browser/chromeos/settings/stats_reporting_controller.cc b/chrome/browser/chromeos/settings/stats_reporting_controller.cc
index e993586..399ced2 100644
--- a/chrome/browser/chromeos/settings/stats_reporting_controller.cc
+++ b/chrome/browser/chromeos/settings/stats_reporting_controller.cc
@@ -95,8 +95,8 @@
return value;
}
-std::unique_ptr<CrosSettings::ObserverSubscription>
-StatsReportingController::AddObserver(const base::RepeatingClosure& callback) {
+base::CallbackListSubscription StatsReportingController::AddObserver(
+ const base::RepeatingClosure& callback) {
DCHECK(!callback.is_null());
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return callback_list_.Add(callback);
diff --git a/chrome/browser/chromeos/settings/stats_reporting_controller.h b/chrome/browser/chromeos/settings/stats_reporting_controller.h
index 288b2a2..91edeb27 100644
--- a/chrome/browser/chromeos/settings/stats_reporting_controller.h
+++ b/chrome/browser/chromeos/settings/stats_reporting_controller.h
@@ -61,8 +61,7 @@
bool IsEnabled();
// Add an observer |callback| for changes to the setting.
- using ObserverSubscription = base::CallbackList<void(void)>::Subscription;
- std::unique_ptr<ObserverSubscription> AddObserver(
+ base::CallbackListSubscription AddObserver(
const base::RepeatingClosure& callback) WARN_UNUSED_RESULT;
// Called once ownership is taken, |service| is the service of the user taking
@@ -124,7 +123,7 @@
PrefService* local_state_;
bool value_notified_to_observers_;
base::CallbackList<void(void)> callback_list_;
- std::unique_ptr<CrosSettings::ObserverSubscription> setting_subscription_;
+ base::CallbackListSubscription setting_subscription_;
base::WeakPtrFactory<StatsReportingController> weak_factory_{this};
diff --git a/chrome/browser/chromeos/settings/stats_reporting_controller_unittest.cc b/chrome/browser/chromeos/settings/stats_reporting_controller_unittest.cc
index e61cdc4b..4a44c60 100644
--- a/chrome/browser/chromeos/settings/stats_reporting_controller_unittest.cc
+++ b/chrome/browser/chromeos/settings/stats_reporting_controller_unittest.cc
@@ -88,7 +88,7 @@
}
void TearDown() override {
- observer_subscription_.reset();
+ observer_subscription_ = {};
StatsReportingController::Shutdown();
}
@@ -102,8 +102,7 @@
policy::DevicePolicyBuilder device_policy_;
bool value_at_last_notification_{false};
- std::unique_ptr<StatsReportingController::ObserverSubscription>
- observer_subscription_;
+ base::CallbackListSubscription observer_subscription_;
scoped_refptr<ownership::MockOwnerKeyUtil> both_keys{
base::MakeRefCounted<ownership::MockOwnerKeyUtil>()};
diff --git a/chrome/browser/chromeos/system/breakpad_consent_watcher.h b/chrome/browser/chromeos/system/breakpad_consent_watcher.h
index ae1fd79..52dfa80 100644
--- a/chrome/browser/chromeos/system/breakpad_consent_watcher.h
+++ b/chrome/browser/chromeos/system/breakpad_consent_watcher.h
@@ -46,7 +46,7 @@
// Called whenever the crash reporting consent is changed.
static void OnConsentChangeCollectStatsConsentThread();
- std::unique_ptr<StatsReportingController::ObserverSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
};
} // namespace system
diff --git a/chrome/browser/chromeos/system/device_disabling_browsertest.cc b/chrome/browser/chromeos/system/device_disabling_browsertest.cc
index b1e7ebe..b5557c0 100644
--- a/chrome/browser/chromeos/system/device_disabling_browsertest.cc
+++ b/chrome/browser/chromeos/system/device_disabling_browsertest.cc
@@ -108,8 +108,8 @@
void DeviceDisablingTest::MarkDisabledAndWaitForPolicyFetch() {
base::RunLoop run_loop;
- // Set up an |observer| that will wait for the disabled setting to change.
- std::unique_ptr<CrosSettings::ObserverSubscription> observer =
+ // Set up an observer that will wait for the disabled setting to change.
+ base::CallbackListSubscription subscription =
CrosSettings::Get()->AddSettingsObserver(kDeviceDisabled,
run_loop.QuitClosure());
SetDeviceDisabledPolicy();
diff --git a/chrome/browser/chromeos/system/device_disabling_manager.h b/chrome/browser/chromeos/system/device_disabling_manager.h
index 94ac434..9f6689b 100644
--- a/chrome/browser/chromeos/system/device_disabling_manager.h
+++ b/chrome/browser/chromeos/system/device_disabling_manager.h
@@ -130,10 +130,8 @@
base::ObserverList<Observer>::Unchecked observers_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- device_disabled_subscription_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- disabled_message_subscription_;
+ base::CallbackListSubscription device_disabled_subscription_;
+ base::CallbackListSubscription disabled_message_subscription_;
// Indicates whether the device was disabled when the cros settings were last
// read.
diff --git a/chrome/browser/chromeos/system/system_clock.h b/chrome/browser/chromeos/system/system_clock.h
index 55a42ed..c1e54d0 100644
--- a/chrome/browser/chromeos/system/system_clock.h
+++ b/chrome/browser/chromeos/system/system_clock.h
@@ -73,10 +73,6 @@
void ActiveUserChanged(user_manager::User* active_user) override;
private:
- // Should be the same as CrosSettings::ObserverSubscription.
- typedef base::CallbackList<void(void)>::Subscription
- CrosSettingsObserverSubscription;
-
void SetProfileByUser(const user_manager::User* user);
void SetProfile(Profile* profile);
@@ -95,7 +91,7 @@
base::ObserverList<SystemClockObserver>::Unchecked observer_list_;
- std::unique_ptr<CrosSettingsObserverSubscription> device_settings_observer_;
+ base::CallbackListSubscription device_settings_observer_;
base::WeakPtrFactory<SystemClock> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.cc b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.cc
index 62c2377..9be9f7c 100644
--- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.cc
+++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.cc
@@ -85,7 +85,7 @@
DCHECK(delegate_);
DCHECK(!g_wilco_dtc_supportd_manager_instance);
g_wilco_dtc_supportd_manager_instance = this;
- wilco_dtc_allowed_observer_ = CrosSettings::Get()->AddSettingsObserver(
+ wilco_dtc_allowed_subscription_ = CrosSettings::Get()->AddSettingsObserver(
kDeviceWilcoDtcAllowed,
base::BindRepeating(&WilcoDtcSupportdManager::StartOrStopWilcoDtc,
weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.h b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.h
index 772800d..90d6c3eed 100644
--- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.h
+++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager.h
@@ -72,8 +72,7 @@
std::unique_ptr<Delegate> delegate_;
// Observer to changes in the wilco DTC allowed policy.
- std::unique_ptr<CrosSettings::ObserverSubscription>
- wilco_dtc_allowed_observer_;
+ base::CallbackListSubscription wilco_dtc_allowed_subscription_;
// The configuration data blob is stored and owned.
std::unique_ptr<std::string> configuration_data_;
diff --git a/chrome/browser/content_settings/content_settings_supervised_provider.cc b/chrome/browser/content_settings/content_settings_supervised_provider.cc
index 1183bd72..8932bc2 100644
--- a/chrome/browser/content_settings/content_settings_supervised_provider.cc
+++ b/chrome/browser/content_settings/content_settings_supervised_provider.cc
@@ -115,7 +115,7 @@
void SupervisedProvider::ShutdownOnUIThread() {
DCHECK(CalledOnValidThread());
RemoveAllObservers();
- user_settings_subscription_.reset();
+ user_settings_subscription_ = {};
}
} // namespace content_settings
diff --git a/chrome/browser/content_settings/content_settings_supervised_provider.h b/chrome/browser/content_settings/content_settings_supervised_provider.h
index 80c24c3c..ad61692b 100644
--- a/chrome/browser/content_settings/content_settings_supervised_provider.h
+++ b/chrome/browser/content_settings/content_settings_supervised_provider.h
@@ -51,9 +51,7 @@
// thread safety.
mutable base::Lock lock_;
- std::unique_ptr<
- base::CallbackList<void(const base::DictionaryValue*)>::Subscription>
- user_settings_subscription_;
+ base::CallbackListSubscription user_settings_subscription_;
DISALLOW_COPY_AND_ASSIGN(SupervisedProvider);
};
diff --git a/chrome/browser/device_identity/chromeos/device_oauth2_token_store_chromeos.h b/chrome/browser/device_identity/chromeos/device_oauth2_token_store_chromeos.h
index ec23125..44e77701 100644
--- a/chrome/browser/device_identity/chromeos/device_oauth2_token_store_chromeos.h
+++ b/chrome/browser/device_identity/chromeos/device_oauth2_token_store_chromeos.h
@@ -64,8 +64,7 @@
PrefService* local_state_;
- std::unique_ptr<CrosSettings::ObserverSubscription>
- service_account_identity_subscription_;
+ base::CallbackListSubscription service_account_identity_subscription_;
// The system salt for encrypting and decrypting the refresh token.
std::string system_salt_;
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index b2858ef..429f16c 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -216,8 +216,7 @@
content::NotificationRegistrar registrar_;
int last_request_id_ = 0;
PendingRequests pending_requests_;
- std::unique_ptr<ExtensionDevToolsInfoBarDelegate::CallbackList::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
api::debugger::DetachReason detach_reason_ =
api::debugger::DETACH_REASON_TARGET_CLOSED;
diff --git a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.cc b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.cc
index 8f946586..f9ba058 100644
--- a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.cc
+++ b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.cc
@@ -32,10 +32,10 @@
// static
constexpr base::TimeDelta ExtensionDevToolsInfoBarDelegate::kAutoCloseDelay;
-std::unique_ptr<ExtensionDevToolsInfoBarDelegate::CallbackList::Subscription>
-ExtensionDevToolsInfoBarDelegate::Create(const std::string& extension_id,
- const std::string& extension_name,
- base::OnceClosure destroyed_callback) {
+base::CallbackListSubscription ExtensionDevToolsInfoBarDelegate::Create(
+ const std::string& extension_id,
+ const std::string& extension_name,
+ base::OnceClosure destroyed_callback) {
Delegates& delegates = g_delegates.Get();
const auto it = delegates.find(extension_id);
if (it != delegates.end()) {
@@ -48,7 +48,7 @@
new ExtensionDevToolsInfoBarDelegate(extension_id, extension_name));
auto* delegate_raw = delegate.get();
delegates[extension_id] = delegate_raw;
- std::unique_ptr<CallbackList::Subscription> subscription =
+ base::CallbackListSubscription subscription =
delegate->RegisterDestroyedCallback(std::move(destroyed_callback));
delegate_raw->infobar_ = GlobalConfirmInfoBar::Show(std::move(delegate));
return subscription;
@@ -105,7 +105,7 @@
: extension_id_(std::move(extension_id)),
extension_name_(base::UTF8ToUTF16(extension_name)) {}
-std::unique_ptr<ExtensionDevToolsInfoBarDelegate::CallbackList::Subscription>
+base::CallbackListSubscription
ExtensionDevToolsInfoBarDelegate::RegisterDestroyedCallback(
base::OnceClosure destroyed_callback) {
return callback_list_.Add(std::move(destroyed_callback));
diff --git a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.h b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.h
index 35d713f6..6870d67 100644
--- a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.h
+++ b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.h
@@ -29,7 +29,7 @@
// Ensures a global infobar corresponding to the supplied extension is
// showing and registers |destroyed_callback| with it to be called back on
// destruction.
- static std::unique_ptr<CallbackList::Subscription> Create(
+ static base::CallbackListSubscription Create(
const std::string& extension_id,
const std::string& extension_name,
base::OnceClosure destroyed_callback);
@@ -55,7 +55,7 @@
const std::string& extension_name);
// Adds |destroyed_callback| to the list of callbacks to run on destruction.
- std::unique_ptr<CallbackList::Subscription> RegisterDestroyedCallback(
+ base::CallbackListSubscription RegisterDestroyedCallback(
base::OnceClosure destroyed_callback);
const std::string extension_id_;
diff --git a/chrome/browser/extensions/api/gcm/gcm_apitest.cc b/chrome/browser/extensions/api/gcm/gcm_apitest.cc
index 30f9982..02f48d2 100644
--- a/chrome/browser/extensions/api/gcm/gcm_apitest.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_apitest.cc
@@ -73,9 +73,7 @@
private:
void OnWillCreateBrowserContextServices(content::BrowserContext* context);
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
void GcmApiTest::SetUpCommandLine(base::CommandLine* command_line) {
diff --git a/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.cc b/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.cc
index 5117425..f8a1477 100644
--- a/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.cc
+++ b/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.cc
@@ -104,7 +104,7 @@
if (!web_flow_ || window_id != web_flow_->GetAppWindowKey())
return;
- identity_api_set_consent_result_subscription_.reset();
+ identity_api_set_consent_result_subscription_ = {};
bool consent_approved = false;
std::string gaia_id;
diff --git a/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.h b/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.h
index 6c2b855f..e6e819c 100644
--- a/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.h
+++ b/chrome/browser/extensions/api/identity/gaia_remote_consent_flow.h
@@ -96,9 +96,7 @@
std::unique_ptr<signin::AccountsCookieMutator::SetAccountsInCookieTask>
set_accounts_in_cookie_task_;
- std::unique_ptr<base::RepeatingCallbackList<
- void(const std::string&, const std::string&)>::Subscription>
- identity_api_set_consent_result_subscription_;
+ base::CallbackListSubscription identity_api_set_consent_result_subscription_;
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
scoped_observer_;
};
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 37858091..6f017a89 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -109,9 +109,7 @@
on_set_consent_result_callback_list_.Notify(result, window_id);
}
-std::unique_ptr<base::RepeatingCallbackList<
- IdentityAPI::OnSetConsentResultSignature>::Subscription>
-IdentityAPI::RegisterOnSetConsentResultCallback(
+base::CallbackListSubscription IdentityAPI::RegisterOnSetConsentResultCallback(
const base::RepeatingCallback<OnSetConsentResultSignature>& callback) {
return on_set_consent_result_callback_list_.Add(callback);
}
@@ -129,8 +127,8 @@
return g_identity_api_factory.Pointer();
}
-std::unique_ptr<base::OnceCallbackList<void()>::Subscription>
-IdentityAPI::RegisterOnShutdownCallback(base::OnceClosure cb) {
+base::CallbackListSubscription IdentityAPI::RegisterOnShutdownCallback(
+ base::OnceClosure cb) {
return on_shutdown_callback_list_.Add(std::move(cb));
}
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index 02b1162..173e7c4 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -69,17 +69,15 @@
// Consent result.
void SetConsentResult(const std::string& result,
const std::string& window_id);
- std::unique_ptr<
- base::RepeatingCallbackList<OnSetConsentResultSignature>::Subscription>
- RegisterOnSetConsentResultCallback(
+ base::CallbackListSubscription RegisterOnSetConsentResultCallback(
const base::RepeatingCallback<OnSetConsentResultSignature>& callback);
// BrowserContextKeyedAPI:
void Shutdown() override;
static BrowserContextKeyedAPIFactory<IdentityAPI>* GetFactoryInstance();
- std::unique_ptr<base::OnceCallbackList<void()>::Subscription>
- RegisterOnShutdownCallback(base::OnceClosure cb);
+ base::CallbackListSubscription RegisterOnShutdownCallback(
+ base::OnceClosure cb);
// Callback that is used in testing contexts to test the implementation of
// the chrome.identity.onSignInChanged event. Note that the passed-in Event is
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index 6f030df..77b1d22 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -630,9 +630,7 @@
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_profile_adaptor_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
class IdentityGetAccountsFunctionTest : public IdentityTestWithSignin {
diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
index 97ca0249..0b89f814 100644
--- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
+++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
@@ -329,7 +329,7 @@
}
void IdentityGetAuthTokenFunction::CompleteAsyncRun(ResponseValue response) {
- identity_api_shutdown_subscription_.reset();
+ identity_api_shutdown_subscription_ = {};
Respond(std::move(response));
Release(); // Balanced in StartAsyncRun
diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
index 164dc03..bc6cf0a1 100644
--- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
+++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
@@ -257,8 +257,7 @@
bool remote_consent_approved_ = false;
// Invoked when IdentityAPI is shut down.
- std::unique_ptr<base::OnceCallbackList<void()>::Subscription>
- identity_api_shutdown_subscription_;
+ base::CallbackListSubscription identity_api_shutdown_subscription_;
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
scoped_identity_manager_observer_{this};
diff --git a/chrome/browser/extensions/api/identity/identity_private_apitest.cc b/chrome/browser/extensions/api/identity/identity_private_apitest.cc
index a1ba200..c2efa40 100644
--- a/chrome/browser/extensions/api/identity/identity_private_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_private_apitest.cc
@@ -50,9 +50,7 @@
std::string consent_result_;
std::string window_id_;
std::unique_ptr<base::RunLoop> callback_loop_;
- std::unique_ptr<base::RepeatingCallbackList<
- IdentityAPI::OnSetConsentResultSignature>::Subscription>
- callback_subscription_;
+ base::CallbackListSubscription callback_subscription_;
};
IN_PROC_BROWSER_TEST_F(IdentityPrivateApiTest, SetConsentResult) {
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index db7a07d..eb21859e0 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -189,9 +189,8 @@
url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
if (url_service_) {
- template_url_sub_ = url_service_->RegisterOnLoadedCallback(
- base::Bind(&OmniboxAPI::OnTemplateURLsLoaded,
- base::Unretained(this)));
+ template_url_subscription_ = url_service_->RegisterOnLoadedCallback(
+ base::Bind(&OmniboxAPI::OnTemplateURLsLoaded, base::Unretained(this)));
}
// Use monochrome icons for Omnibox icons.
@@ -199,7 +198,7 @@
}
void OmniboxAPI::Shutdown() {
- template_url_sub_.reset();
+ template_url_subscription_ = {};
}
OmniboxAPI::~OmniboxAPI() {
@@ -257,7 +256,7 @@
void OmniboxAPI::OnTemplateURLsLoaded() {
// Register keywords for pending extensions.
- template_url_sub_.reset();
+ template_url_subscription_ = {};
for (const auto* i : pending_extensions_) {
url_service_->RegisterOmniboxKeyword(
i->id(), i->short_name(), OmniboxInfo::GetKeyword(i),
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chrome/browser/extensions/api/omnibox/omnibox_api.h
index 37f4d2de7..c8515e7 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -139,7 +139,7 @@
// Keeps track of favicon-sized omnibox icons for extensions.
ExtensionIconManager omnibox_icon_manager_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
+ base::CallbackListSubscription template_url_subscription_;
DISALLOW_COPY_AND_ASSIGN(OmniboxAPI);
};
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
index 7f5cdc1..1306388b 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
@@ -99,8 +99,8 @@
std::string pref_name = it.first;
if (prefs_util_->IsCrosSetting(pref_name)) {
#if defined(OS_CHROMEOS)
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- subscription = chromeos::CrosSettings::Get()->AddSettingsObserver(
+ base::CallbackListSubscription subscription =
+ chromeos::CrosSettings::Get()->AddSettingsObserver(
pref_name.c_str(),
base::Bind(&SettingsPrivateEventRouter::OnPreferenceChanged,
base::Unretained(this), pref_name));
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_event_router.h b/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
index 3471e74..25b5742 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
+++ b/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
@@ -74,9 +74,7 @@
PrefChangeRegistrar* FindRegistrarForPref(const std::string& pref_name);
#if defined(OS_CHROMEOS)
- using SubscriptionMap =
- std::map<std::string,
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>>;
+ using SubscriptionMap = std::map<std::string, base::CallbackListSubscription>;
SubscriptionMap cros_settings_subscription_map_;
#endif
diff --git a/chrome/browser/extensions/blocklist.cc b/chrome/browser/extensions/blocklist.cc
index cc678a6..4272f3c 100644
--- a/chrome/browser/extensions/blocklist.cc
+++ b/chrome/browser/extensions/blocklist.cc
@@ -54,8 +54,8 @@
database_changed_callback_list_.Notify();
}
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- RegisterDatabaseChangedCallback(const base::RepeatingClosure& cb) {
+ base::CallbackListSubscription RegisterDatabaseChangedCallback(
+ const base::RepeatingClosure& cb) {
return database_changed_callback_list_.Add(cb);
}
@@ -325,7 +325,7 @@
}
void Blocklist::ResetDatabaseUpdatedListenerForTest() {
- database_updated_subscription_.reset();
+ database_updated_subscription_ = {};
}
void Blocklist::AddObserver(Observer* observer) {
@@ -353,13 +353,13 @@
auto database_manager = GetDatabaseManager();
if (database_manager.get()) {
// Using base::Unretained is safe because when this object goes away, the
- // subscription to the callback list will automatically be destroyed.
+ // subscription from the callback list will automatically be destroyed.
database_updated_subscription_ =
database_manager.get()->RegisterDatabaseUpdatedCallback(
base::BindRepeating(&Blocklist::NotifyObservers,
base::Unretained(this)));
} else {
- database_updated_subscription_.reset();
+ database_updated_subscription_ = {};
}
}
diff --git a/chrome/browser/extensions/blocklist.h b/chrome/browser/extensions/blocklist.h
index dd18a88..118e101 100644
--- a/chrome/browser/extensions/blocklist.h
+++ b/chrome/browser/extensions/blocklist.h
@@ -139,10 +139,8 @@
base::ObserverList<Observer>::Unchecked observers_;
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- database_updated_subscription_;
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- database_changed_subscription_;
+ base::CallbackListSubscription database_updated_subscription_;
+ base::CallbackListSubscription database_changed_subscription_;
// The cached BlocklistState's, received from BlocklistStateFetcher.
BlocklistStateMap blocklist_state_cache_;
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
index e53e541a7..9d288cd1 100644
--- a/chrome/browser/extensions/permissions_updater.cc
+++ b/chrome/browser/extensions/permissions_updater.cc
@@ -152,8 +152,7 @@
void OnOriginAccessUpdated();
base::OnceClosure dispatch_event_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_subscription_;
+ base::CallbackListSubscription shutdown_subscription_;
base::WeakPtrFactory<NetworkPermissionsUpdateHelper> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetworkPermissionsUpdateHelper);
diff --git a/chrome/browser/extensions/state_store_notification_observer.cc b/chrome/browser/extensions/state_store_notification_observer.cc
index 0754328..79501bf5 100644
--- a/chrome/browser/extensions/state_store_notification_observer.cc
+++ b/chrome/browser/extensions/state_store_notification_observer.cc
@@ -25,7 +25,7 @@
void StateStoreNotificationObserver::OnSessionRestoreDone(
int /* num_tabs_restored */) {
- on_session_restored_callback_subscription_.reset();
+ on_session_restored_callback_subscription_ = {};
state_store_->RequestInitAfterDelay();
}
diff --git a/chrome/browser/extensions/state_store_notification_observer.h b/chrome/browser/extensions/state_store_notification_observer.h
index 8b30127..9b353fb 100644
--- a/chrome/browser/extensions/state_store_notification_observer.h
+++ b/chrome/browser/extensions/state_store_notification_observer.h
@@ -28,11 +28,10 @@
// Points to the on-session-restored callback that was registered with
// SessionRestore's callback list. When objects of this class are destroyed,
- // the subscription object's destructor will automatically unregister the
- // callback in SessionRestore, so that the callback list does not contain any
- // obsolete callbacks.
- SessionRestore::CallbackSubscription
- on_session_restored_callback_subscription_;
+ // the subscription's destructor will automatically unregister the callback in
+ // SessionRestore, so that the callback list does not contain any obsolete
+ // callbacks.
+ base::CallbackListSubscription on_session_restored_callback_subscription_;
DISALLOW_COPY_AND_ASSIGN(StateStoreNotificationObserver);
};
diff --git a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
index 2e70bc23..a462aac 100644
--- a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
+++ b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
@@ -444,9 +444,7 @@
base::ScopedTempDir scoped_temp_dir_;
int next_unique_file_suffix_ = 1;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
};
IN_PROC_BROWSER_TEST_F(FlocIdProviderWithCustomizedServicesBrowserTest,
diff --git a/chrome/browser/history/chrome_history_client.cc b/chrome/browser/history/chrome_history_client.cc
index 4ffc0ff..c529158 100644
--- a/chrome/browser/history/chrome_history_client.cc
+++ b/chrome/browser/history/chrome_history_client.cc
@@ -40,7 +40,7 @@
}
void ChromeHistoryClient::Shutdown() {
- favicons_changed_subscription_.reset();
+ favicons_changed_subscription_ = {};
StopObservingBookmarkModel();
}
diff --git a/chrome/browser/history/chrome_history_client.h b/chrome/browser/history/chrome_history_client.h
index 0c8b0cce..48452aa 100644
--- a/chrome/browser/history/chrome_history_client.h
+++ b/chrome/browser/history/chrome_history_client.h
@@ -61,9 +61,7 @@
base::RepeatingCallback<void(const std::set<GURL>&)> on_bookmarks_removed_;
// Subscription for notifications of changes to favicons.
- std::unique_ptr<
- history::HistoryService::FaviconsChangedCallbackList::Subscription>
- favicons_changed_subscription_;
+ base::CallbackListSubscription favicons_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient);
};
diff --git a/chrome/browser/importer/external_process_importer_host.cc b/chrome/browser/importer/external_process_importer_host.cc
index 4ec46dce1..8c88438 100644
--- a/chrome/browser/importer/external_process_importer_host.cc
+++ b/chrome/browser/importer/external_process_importer_host.cc
@@ -98,7 +98,7 @@
}
void ExternalProcessImporterHost::LaunchImportIfReady() {
- if (waiting_for_bookmarkbar_model_ || template_service_subscription_.get() ||
+ if (waiting_for_bookmarkbar_model_ || template_service_subscription_ ||
!is_source_readable_ || cancelled_)
return;
@@ -134,7 +134,7 @@
}
void ExternalProcessImporterHost::OnTemplateURLServiceLoaded() {
- template_service_subscription_.reset();
+ template_service_subscription_ = {};
LaunchImportIfReady();
}
diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h
index f8bd5d5..d6d2ad0 100644
--- a/chrome/browser/importer/external_process_importer_host.h
+++ b/chrome/browser/importer/external_process_importer_host.h
@@ -132,10 +132,8 @@
// True if we're waiting for the model to finish loading.
bool waiting_for_bookmarkbar_model_;
- // May contain a Subscription waiting for the TemplateURLService to finish
- // loading.
- std::unique_ptr<TemplateURLService::Subscription>
- template_service_subscription_;
+ // Non-empty when waiting for the TemplateURLService to finish loading.
+ base::CallbackListSubscription template_service_subscription_;
// Have we installed a listener on the bookmark model?
bool installed_bookmark_observer_;
diff --git a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.cc b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.cc
index cb56183..9f98768 100644
--- a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.cc
@@ -100,7 +100,7 @@
return app_discovery_service_.get();
}
-DialMediaSinkServiceImpl::SinkQueryByAppSubscription
+base::CallbackListSubscription
DialMediaSinkServiceImpl::StartMonitoringAvailableSinksForApp(
const std::string& app_name,
const SinkQueryByAppCallback& callback) {
diff --git a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h
index 0089882..1a3e3dd 100644
--- a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h
+++ b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h
@@ -40,8 +40,6 @@
using SinkQueryByAppCallbackList =
base::RepeatingCallbackList<void(const std::string&)>;
using SinkQueryByAppCallback = SinkQueryByAppCallbackList::CallbackType;
- using SinkQueryByAppSubscription =
- std::unique_ptr<SinkQueryByAppCallbackList::Subscription>;
// Represents DIAL app status on receiver device.
enum SinkAppStatus { kUnknown = 0, kAvailable, kUnavailable };
@@ -68,11 +66,10 @@
virtual DialAppDiscoveryService* app_discovery_service();
// Registers |callback| to callback list entry in |sink_queries_|, with the
- // key |app_name|. Returns a unique_ptr of callback list subscription. Caller
- // owns the returned subscription and is responsible for destroying when it
- // wants to unregister |callback|.
- // Marked virtual for tests.
- virtual SinkQueryByAppSubscription StartMonitoringAvailableSinksForApp(
+ // key |app_name|. Caller owns the returned subscription and is responsible
+ // for destroying when it wants to unregister |callback|. Marked virtual for
+ // tests.
+ virtual base::CallbackListSubscription StartMonitoringAvailableSinksForApp(
const std::string& app_name,
const SinkQueryByAppCallback& callback);
diff --git a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl_unittest.cc
index 7efbbf36..6b653e0 100644
--- a/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl_unittest.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl_unittest.cc
@@ -74,8 +74,8 @@
base::RunLoop().RunUntilIdle();
}
- DialMediaSinkServiceImpl::SinkQueryByAppSubscription
- StartMonitoringAvailableSinksForApp(const std::string& app_name) {
+ base::CallbackListSubscription StartMonitoringAvailableSinksForApp(
+ const std::string& app_name) {
return media_sink_service_->StartMonitoringAvailableSinksForApp(
app_name, base::BindRepeating(
&DialMediaSinkServiceImplTest::GetAvailableSinksForApp,
@@ -234,13 +234,15 @@
DoFetchDialAppInfo(sink_id, "YouTube"))
.Times(1);
media_sink_service_->AddOrUpdateSink(dial_sink_1_);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
- auto sub2 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription2 =
+ StartMonitoringAvailableSinksForApp("YouTube");
EXPECT_EQ(1u, media_sink_service_->sink_queries_.size());
- sub1.reset();
+ subscription1 = {};
EXPECT_EQ(1u, media_sink_service_->sink_queries_.size());
- sub2.reset();
+ subscription2 = {};
EXPECT_TRUE(media_sink_service_->sink_queries_.empty());
}
@@ -257,7 +259,8 @@
const MediaSink::Id& sink_id = dial_sink_1_.sink().id();
EXPECT_CALL(*this, OnSinksAvailableForApp("YouTube", _)).Times(0);
- auto sub = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription =
+ StartMonitoringAvailableSinksForApp("YouTube");
media_sink_service_->OnAppInfoParseCompleted(
sink_id, "YouTube", CreateDialAppInfoResult("YouTube"));
}
@@ -278,8 +281,10 @@
EXPECT_CALL(*mock_app_discovery_service_,
DoFetchDialAppInfo(sink_id2, "Netflix"));
EXPECT_CALL(*this, OnSinksAvailableForApp(_, _)).Times(0);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
- auto sub2 = StartMonitoringAvailableSinksForApp("Netflix");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription2 =
+ StartMonitoringAvailableSinksForApp("Netflix");
// Either kStopped or kRunning means the app is available on the sink.
EXPECT_CALL(*this,
@@ -301,7 +306,7 @@
sink_id2, "Netflix", CreateDialAppInfoResult("Netflix"));
// Stop listening for Netflix.
- sub2.reset();
+ subscription2 = {};
EXPECT_CALL(*this, OnSinksAvailableForApp("Netflix", _)).Times(0);
media_sink_service_->OnAppInfoParseCompleted(
sink_id1, "Netflix", CreateDialAppInfoResult("Netflix"));
@@ -316,7 +321,8 @@
EXPECT_CALL(*mock_app_discovery_service_, DoFetchDialAppInfo(_, _));
media_sink_service_->AddOrUpdateSink(dial_sink_1_);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
EXPECT_CALL(*this,
OnSinksAvailableForApp(
@@ -335,7 +341,8 @@
EXPECT_CALL(*mock_app_discovery_service_, DoFetchDialAppInfo(_, _));
media_sink_service_->AddOrUpdateSink(dial_sink_1_);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
EXPECT_CALL(*this,
OnSinksAvailableForApp(
@@ -350,7 +357,8 @@
TEST_F(DialMediaSinkServiceImplTest, StartAfterStopMonitoringForApp) {
EXPECT_CALL(*mock_app_discovery_service_, DoFetchDialAppInfo(_, _));
media_sink_service_->AddOrUpdateSink(dial_sink_1_);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
std::vector<MediaSinkInternal> expected_sinks = {dial_sink_1_};
EXPECT_CALL(*this, OnSinksAvailableForApp("YouTube", expected_sinks))
@@ -358,10 +366,11 @@
media_sink_service_->OnAppInfoParseCompleted(
dial_sink_1_.sink().id(), "YouTube", CreateDialAppInfoResult("YouTube"));
- sub1.reset();
+ subscription1 = {};
EXPECT_EQ(expected_sinks, media_sink_service_->GetAvailableSinks("YouTube"));
- auto sub2 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription2 =
+ StartMonitoringAvailableSinksForApp("YouTube");
EXPECT_EQ(expected_sinks, media_sink_service_->GetAvailableSinks("YouTube"));
}
@@ -372,7 +381,8 @@
EXPECT_CALL(*mock_app_discovery_service_, DoFetchDialAppInfo(_, _)).Times(0);
media_sink_service_->AddOrUpdateSink(dial_sink_1_);
- auto sub1 = StartMonitoringAvailableSinksForApp("YouTube");
+ base::CallbackListSubscription subscription1 =
+ StartMonitoringAvailableSinksForApp("YouTube");
}
} // namespace media_router
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.h b/chrome/browser/media/router/mojo/media_router_desktop.h
index ee103f0..baaef5f 100644
--- a/chrome/browser/media/router/mojo/media_router_desktop.h
+++ b/chrome/browser/media/router/mojo/media_router_desktop.h
@@ -160,7 +160,7 @@
dial_provider_;
DualMediaSinkService* media_sink_service_;
- DualMediaSinkService::Subscription media_sink_service_subscription_;
+ base::CallbackListSubscription media_sink_service_subscription_;
// A flag to ensure that we record the provider version once, during the
// initial event page wakeup attempt.
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
index 8109c07c..12f3608f 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -1027,7 +1027,7 @@
blink::mojom::PresentationInfo connection(presentation_url, kPresentationId);
base::MockCallback<content::PresentationConnectionStateChangedCallback>
callback;
- std::unique_ptr<PresentationConnectionStateSubscription> subscription =
+ base::CallbackListSubscription subscription =
router()->AddPresentationConnectionStateChangedCallback(route_id,
callback.Get());
@@ -1065,12 +1065,12 @@
MediaRoute::Id route_id("route-id");
base::MockCallback<content::PresentationConnectionStateChangedCallback>
callback;
- std::unique_ptr<PresentationConnectionStateSubscription> subscription =
+ base::CallbackListSubscription subscription =
router()->AddPresentationConnectionStateChangedCallback(route_id,
callback.Get());
// Callback has been removed, so we don't expect it to be called anymore.
- subscription.reset();
+ subscription = {};
EXPECT_TRUE(router()->presentation_connection_state_callbacks_.empty());
EXPECT_CALL(callback, Run(_)).Times(0);
diff --git a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc
index 30dc58f1..0b35cf8 100644
--- a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc
+++ b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc
@@ -48,7 +48,7 @@
media_sink_service_->RemoveObserver(this);
}
-CastAppDiscoveryService::Subscription
+base::CallbackListSubscription
CastAppDiscoveryServiceImpl::StartObservingMediaSinks(
const CastMediaSource& source,
const SinkQueryCallback& callback) {
diff --git a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.h b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.h
index 6a472b94..ce4eb7d 100644
--- a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.h
+++ b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.h
@@ -44,15 +44,14 @@
const std::vector<MediaSinkInternal>& sinks);
using SinkQueryCallback = base::RepeatingCallback<SinkQueryFunc>;
using SinkQueryCallbackList = base::CallbackList<SinkQueryFunc>;
- using Subscription = std::unique_ptr<SinkQueryCallbackList::Subscription>;
virtual ~CastAppDiscoveryService() = default;
// Adds a sink query for |source|. Results will be continuously returned via
- // |callback| until the returned Subscription is destroyed by the caller.
- // If there are cached results available, |callback| will be invoked before
- // this method returns.
- virtual Subscription StartObservingMediaSinks(
+ // |callback| until the returned subscription is destroyed by the caller. If
+ // there are cached results available, |callback| will be invoked before this
+ // method returns.
+ virtual base::CallbackListSubscription StartObservingMediaSinks(
const CastMediaSource& source,
const SinkQueryCallback& callback) = 0;
@@ -84,7 +83,7 @@
~CastAppDiscoveryServiceImpl() override;
// CastAppDiscoveryService implementation.
- Subscription StartObservingMediaSinks(
+ base::CallbackListSubscription StartObservingMediaSinks(
const CastMediaSource& source,
const SinkQueryCallback& callback) override;
diff --git a/chrome/browser/media/router/providers/cast/cast_app_discovery_service_unittest.cc b/chrome/browser/media/router/providers/cast/cast_app_discovery_service_unittest.cc
index 85fe9f9..3755100f 100644
--- a/chrome/browser/media/router/providers/cast/cast_app_discovery_service_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_app_discovery_service_unittest.cc
@@ -59,7 +59,7 @@
media_sink_service_.RemoveSink(sink);
}
- CastAppDiscoveryService::Subscription StartObservingMediaSinksInitially(
+ base::CallbackListSubscription StartObservingMediaSinksInitially(
const CastMediaSource& source) {
auto subscription = app_discovery_service_->StartObservingMediaSinks(
source,
@@ -114,7 +114,7 @@
std::move(cb).Run("AAAAAAAA", GetAppAvailabilityResult::kAvailable);
// No more updates for |source_a_1_|.
- subscription1.reset();
+ subscription1 = {};
EXPECT_CALL(*this, OnSinkQueryUpdated(source_a_1_.source_id(), _)).Times(0);
EXPECT_CALL(*this,
OnSinkQueryUpdated(source_a_2_.source_id(), testing::IsEmpty()));
@@ -140,7 +140,7 @@
EXPECT_CALL(*this, OnSinkQueryUpdated(source_a_1_.source_id(), sinks_1));
std::move(cb).Run("AAAAAAAA", GetAppAvailabilityResult::kAvailable);
- subscription1.reset();
+ subscription1 = {};
// Request not re-sent; cached kAvailable value is used.
EXPECT_CALL(message_handler_, RequestAppAvailability(_, _, _)).Times(0);
diff --git a/chrome/browser/media/router/providers/cast/cast_media_route_provider.h b/chrome/browser/media/router/providers/cast/cast_media_route_provider.h
index f098a5b..17fc478 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_route_provider.h
+++ b/chrome/browser/media/router/providers/cast/cast_media_route_provider.h
@@ -130,8 +130,7 @@
cast_channel::CastMessageHandler* const message_handler_;
// Registered sink queries.
- base::flat_map<MediaSource::Id, CastAppDiscoveryService::Subscription>
- sink_queries_;
+ base::flat_map<MediaSource::Id, base::CallbackListSubscription> sink_queries_;
std::unique_ptr<CastActivityManager> activity_manager_;
diff --git a/chrome/browser/media/router/providers/cast/dual_media_sink_service.cc b/chrome/browser/media/router/providers/cast/dual_media_sink_service.cc
index 6704cf4..9330683 100644
--- a/chrome/browser/media/router/providers/cast/dual_media_sink_service.cc
+++ b/chrome/browser/media/router/providers/cast/dual_media_sink_service.cc
@@ -44,8 +44,7 @@
return cast_media_sink_service_->impl();
}
-DualMediaSinkService::Subscription
-DualMediaSinkService::AddSinksDiscoveredCallback(
+base::CallbackListSubscription DualMediaSinkService::AddSinksDiscoveredCallback(
const OnSinksDiscoveredProviderCallback& callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return sinks_discovered_callbacks_.Add(callback);
diff --git a/chrome/browser/media/router/providers/cast/dual_media_sink_service.h b/chrome/browser/media/router/providers/cast/dual_media_sink_service.h
index 4698287..f8527a95 100644
--- a/chrome/browser/media/router/providers/cast/dual_media_sink_service.h
+++ b/chrome/browser/media/router/providers/cast/dual_media_sink_service.h
@@ -43,8 +43,6 @@
using OnSinksDiscoveredProviderCallbackList =
base::CallbackList<void(const std::string&,
const std::vector<MediaSinkInternal>&)>;
- using Subscription =
- std::unique_ptr<OnSinksDiscoveredProviderCallbackList::Subscription>;
// Returns the lazily-created leaky singleton instance.
static DualMediaSinkService* GetInstance();
@@ -67,9 +65,9 @@
}
// Adds |callback| to be notified when the list of discovered sinks changes.
- // The caller is responsible for destroying the returned Subscription when it
+ // The caller is responsible for destroying the returned subscription when it
// no longer wishes to receive updates.
- Subscription AddSinksDiscoveredCallback(
+ base::CallbackListSubscription AddSinksDiscoveredCallback(
const OnSinksDiscoveredProviderCallback& callback);
// Instantiate two PendingRemote objects. The objects will be bound with
diff --git a/chrome/browser/media/router/providers/cast/dual_media_sink_service_unittest.cc b/chrome/browser/media/router/providers/cast/dual_media_sink_service_unittest.cc
index d4fa67b..3b8d7702 100644
--- a/chrome/browser/media/router/providers/cast/dual_media_sink_service_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/dual_media_sink_service_unittest.cc
@@ -79,7 +79,7 @@
EXPECT_EQ(sink_map, dual_media_sink_service()->current_sinks());
// |this| no longer receive updates.
- subscription.reset();
+ subscription = {};
std::string cast_provider_name = "cast";
MediaSinkInternal cast_sink;
diff --git a/chrome/browser/media/router/providers/dial/dial_media_route_provider.h b/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
index 339dbcd..711b473 100644
--- a/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
+++ b/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
@@ -131,7 +131,7 @@
// Set of registered media sources for current sink query.
base::flat_set<MediaSource> media_sources;
- DialMediaSinkServiceImpl::SinkQueryByAppSubscription subscription;
+ base::CallbackListSubscription subscription;
DISALLOW_COPY_AND_ASSIGN(MediaSinkQuery);
};
diff --git a/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc b/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
index 2175683e7..8465fb0 100644
--- a/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
+++ b/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
@@ -44,7 +44,7 @@
return &app_discovery_service_;
}
- SinkQueryByAppSubscription StartMonitoringAvailableSinksForApp(
+ base::CallbackListSubscription StartMonitoringAvailableSinksForApp(
const std::string& app_name,
const SinkQueryByAppCallback& callback) override {
DoStartMonitoringAvailableSinksForApp(app_name);
diff --git a/chrome/browser/media/router/test/provider_test_helpers.cc b/chrome/browser/media/router/test/provider_test_helpers.cc
index 6cafc994..f3a0913 100644
--- a/chrome/browser/media/router/test/provider_test_helpers.cc
+++ b/chrome/browser/media/router/test/provider_test_helpers.cc
@@ -26,7 +26,7 @@
MockCastAppDiscoveryService::MockCastAppDiscoveryService() {}
MockCastAppDiscoveryService::~MockCastAppDiscoveryService() = default;
-CastAppDiscoveryService::Subscription
+base::CallbackListSubscription
MockCastAppDiscoveryService::StartObservingMediaSinks(
const CastMediaSource& source,
const CastAppDiscoveryService::SinkQueryCallback& callback) {
diff --git a/chrome/browser/media/router/test/provider_test_helpers.h b/chrome/browser/media/router/test/provider_test_helpers.h
index 972dd93..453be5aa 100644
--- a/chrome/browser/media/router/test/provider_test_helpers.h
+++ b/chrome/browser/media/router/test/provider_test_helpers.h
@@ -60,7 +60,7 @@
MockCastAppDiscoveryService();
~MockCastAppDiscoveryService() override;
- Subscription StartObservingMediaSinks(
+ base::CallbackListSubscription StartObservingMediaSinks(
const CastMediaSource& source,
const SinkQueryCallback& callback) override;
scoped_refptr<base::SequencedTaskRunner> task_runner() override;
diff --git a/chrome/browser/media_galleries/gallery_watch_manager.h b/chrome/browser/media_galleries/gallery_watch_manager.h
index 8834dea..4a4e439 100644
--- a/chrome/browser/media_galleries/gallery_watch_manager.h
+++ b/chrome/browser/media_galleries/gallery_watch_manager.h
@@ -114,8 +114,7 @@
typedef std::map<base::FilePath, NotificationInfo> WatchedPaths;
typedef std::map<content::BrowserContext*, GalleryWatchManagerObserver*>
ObserverMap;
- typedef std::map<content::BrowserContext*,
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>>
+ typedef std::map<content::BrowserContext*, base::CallbackListSubscription>
BrowserContextSubscriptionMap;
// Ensure there is a subscription to shutdown notifications for
diff --git a/chrome/browser/media_galleries/media_file_system_registry.h b/chrome/browser/media_galleries/media_file_system_registry.h
index 931cc5f..d4b421d 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.h
+++ b/chrome/browser/media_galleries/media_file_system_registry.h
@@ -110,8 +110,7 @@
// Map a profile and extension to the ExtensionGalleriesHost.
typedef std::map<Profile*, ExtensionHostMap> ExtensionGalleriesHostMap;
// Map a profile to a shutdown notification subscription.
- typedef std::map<Profile*,
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>>
+ typedef std::map<Profile*, base::CallbackListSubscription>
ProfileSubscriptionMap;
void OnPermissionRemoved(MediaGalleriesPreferences* pref,
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h
index 116765e..b7fafa1 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.h
+++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -199,8 +199,7 @@
// Subscription for receiving callbacks that a URL was opened from the
// omnibox.
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- omnibox_url_opened_subscription_;
+ base::CallbackListSubscription omnibox_url_opened_subscription_;
#if !defined(OS_ANDROID)
std::unique_ptr<BrowserActivityWatcher> browser_activity_watcher_;
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
index 9f887026..c2cfc10 100644
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -243,7 +243,7 @@
#if defined(OS_CHROMEOS)
void ChromeMetricsServicesManagerClient::OnCrosSettingsCreated() {
- reporting_setting_observer_ =
+ reporting_setting_subscription_ =
chromeos::StatsReportingController::Get()->AddObserver(
base::BindRepeating(&OnCrosMetricsReportingSettingChange));
// Invoke the callback once initially to set the metrics reporting state.
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.h b/chrome/browser/metrics/chrome_metrics_services_manager_client.h
index d827ef8..cab3b70 100644
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.h
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.h
@@ -104,8 +104,7 @@
PrefService* const local_state_;
#if defined(OS_CHROMEOS)
- std::unique_ptr<chromeos::StatsReportingController::ObserverSubscription>
- reporting_setting_observer_;
+ base::CallbackListSubscription reporting_setting_subscription_;
#endif
DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServicesManagerClient);
diff --git a/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.cc b/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.cc
index c076ab0..76f5517 100644
--- a/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.cc
+++ b/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.cc
@@ -25,8 +25,8 @@
: touch_ui_controller_(touch_ui_controller) {
session_duration_tracker->AddObserver(this);
- // If this instance is destroyed, |mode_change_subscription_|'s
- // destructor will unregister the callback. Hence Unretained is safe.
+ // If this instance is destroyed, |mode_change_subscription_|'s destructor
+ // will unregister the callback. Hence Unretained is safe.
mode_change_subscription_ =
touch_ui_controller->RegisterCallback(base::BindRepeating(
&TouchModeStatsTracker::TouchModeChanged, base::Unretained(this)));
diff --git a/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h b/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h
index 0c4e122..1503aac 100644
--- a/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h
+++ b/chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h
@@ -42,8 +42,7 @@
ui::TouchUiController* const touch_ui_controller_;
- std::unique_ptr<ui::TouchUiController::Subscription>
- mode_change_subscription_;
+ base::CallbackListSubscription mode_change_subscription_;
// The time passed by OnSessionStarted() if there is an ongoing
// session, or 0 otherwise.
diff --git a/chrome/browser/metrics/perf/profile_provider_chromeos.h b/chrome/browser/metrics/perf/profile_provider_chromeos.h
index 19e72ae5..73c9c1f1 100644
--- a/chrome/browser/metrics/perf/profile_provider_chromeos.h
+++ b/chrome/browser/metrics/perf/profile_provider_chromeos.h
@@ -74,11 +74,10 @@
private:
// Points to the on-session-restored callback that was registered with
// SessionRestore's callback list. When objects of this class are destroyed,
- // the subscription object's destructor will automatically unregister the
- // callback in SessionRestore, so that the callback list does not contain any
- // obsolete callbacks.
- SessionRestore::CallbackSubscription
- on_session_restored_callback_subscription_;
+ // the subscription's destructor will automatically unregister the callback in
+ // SessionRestore, so that the callback list does not contain any obsolete
+ // callbacks.
+ base::CallbackListSubscription on_session_restored_callback_subscription_;
scoped_refptr<content::JankMonitor> jank_monitor_;
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
index 1ea199c..e9a68f1e 100644
--- a/chrome/browser/metrics/thread_watcher.cc
+++ b/chrome/browser/metrics/thread_watcher.cc
@@ -82,8 +82,7 @@
// Subscription for receiving callbacks that a URL was opened from the
// omnibox.
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- omnibox_url_opened_subscription_;
+ base::CallbackListSubscription omnibox_url_opened_subscription_;
DISALLOW_COPY_AND_ASSIGN(ThreadWatcherObserver);
};
diff --git a/chrome/browser/metrics/ukm_browsertest.cc b/chrome/browser/metrics/ukm_browsertest.cc
index 9a5d0cb..7fa8145 100644
--- a/chrome/browser/metrics/ukm_browsertest.cc
+++ b/chrome/browser/metrics/ukm_browsertest.cc
@@ -317,7 +317,7 @@
// This is required to support (fake) secondary-account-signin (based on
// cookies) in tests. Without this, the real GaiaCookieManagerService would
// try talking to Google servers which of course wouldn't work in tests.
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
UkmBrowserTestBase::SetUpInProcessBrowserTestFixture();
}
@@ -330,8 +330,7 @@
}
private:
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
DISALLOW_COPY_AND_ASSIGN(UkmBrowserTestWithSyncTransport);
};
diff --git a/chrome/browser/notifications/arc_application_notifier_controller.cc b/chrome/browser/notifications/arc_application_notifier_controller.cc
index 190c5e5..8519bdc 100644
--- a/chrome/browser/notifications/arc_application_notifier_controller.cc
+++ b/chrome/browser/notifications/arc_application_notifier_controller.cc
@@ -138,17 +138,18 @@
void ArcApplicationNotifierController::StartObserving() {
ArcAppListPrefs::Get(last_profile_)->AddObserver(this);
- shutdown_notifier_ = ArcAppNotifierShutdownNotifierFactory::GetInstance()
- ->Get(last_profile_)
- ->Subscribe(base::BindRepeating(
- &ArcApplicationNotifierController::StopObserving,
- base::Unretained(this)));
+ shutdown_subscription_ =
+ ArcAppNotifierShutdownNotifierFactory::GetInstance()
+ ->Get(last_profile_)
+ ->Subscribe(base::BindRepeating(
+ &ArcApplicationNotifierController::StopObserving,
+ base::Unretained(this)));
}
void ArcApplicationNotifierController::StopObserving() {
if (!last_profile_)
return;
- shutdown_notifier_.reset();
+ shutdown_subscription_ = {};
ArcAppListPrefs::Get(last_profile_)->RemoveObserver(this);
last_profile_ = nullptr;
}
diff --git a/chrome/browser/notifications/arc_application_notifier_controller.h b/chrome/browser/notifications/arc_application_notifier_controller.h
index 5b3e7f03..94e7220 100644
--- a/chrome/browser/notifications/arc_application_notifier_controller.h
+++ b/chrome/browser/notifications/arc_application_notifier_controller.h
@@ -54,8 +54,7 @@
std::vector<std::unique_ptr<ArcAppIcon>> icons_;
std::map<std::string, std::string> package_to_app_ids_;
Profile* last_profile_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_subscription_;
};
} // namespace arc
diff --git a/chrome/browser/notifications/notification_display_service_tester.cc b/chrome/browser/notifications/notification_display_service_tester.cc
index a2286371c..7a84a61 100644
--- a/chrome/browser/notifications/notification_display_service_tester.cc
+++ b/chrome/browser/notifications/notification_display_service_tester.cc
@@ -168,5 +168,5 @@
void NotificationDisplayServiceTester::OnProfileShutdown() {
profile_ = nullptr;
- profile_shutdown_subscription_.reset();
+ profile_shutdown_subscription_ = {};
}
diff --git a/chrome/browser/notifications/notification_display_service_tester.h b/chrome/browser/notifications/notification_display_service_tester.h
index 1571e882f..738bd8f 100644
--- a/chrome/browser/notifications/notification_display_service_tester.h
+++ b/chrome/browser/notifications/notification_display_service_tester.h
@@ -92,8 +92,7 @@
Profile* profile_;
StubNotificationDisplayService* display_service_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- profile_shutdown_subscription_;
+ base::CallbackListSubscription profile_shutdown_subscription_;
};
#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_TESTER_H_
diff --git a/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc b/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc
index 505c45b..f64f1ae9 100644
--- a/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc
+++ b/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc
@@ -223,9 +223,7 @@
content::WebContents* web_contents_ = nullptr;
std::unique_ptr<ServerUrlLoader> server_url_loader_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
DISALLOW_COPY_AND_ASSIGN(CapturedSitesPasswordManagerBrowserTest);
};
diff --git a/chrome/browser/password_manager/password_manager_test_base.h b/chrome/browser/password_manager/password_manager_test_base.h
index 6fd24ac..21f735a 100644
--- a/chrome/browser/password_manager/password_manager_test_base.h
+++ b/chrome/browser/password_manager/password_manager_test_base.h
@@ -245,9 +245,7 @@
// A tab with some hooks injected.
content::WebContents* web_contents_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase);
};
diff --git a/chrome/browser/plugins/plugin_info_host_impl.cc b/chrome/browser/plugins/plugin_info_host_impl.cc
index 1d19e68..3c6e141 100644
--- a/chrome/browser/plugins/plugin_info_host_impl.cc
+++ b/chrome/browser/plugins/plugin_info_host_impl.cc
@@ -149,7 +149,7 @@
PluginInfoHostImpl::PluginInfoHostImpl(int render_process_id, Profile* profile)
: context_(render_process_id, profile) {
- shutdown_notifier_ =
+ shutdown_subscription_ =
PluginInfoHostImplShutdownNotifierFactory::GetInstance()
->Get(profile)
->Subscribe(base::Bind(&PluginInfoHostImpl::ShutdownOnUIThread,
@@ -159,7 +159,7 @@
void PluginInfoHostImpl::ShutdownOnUIThread() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
context_.ShutdownOnUIThread();
- shutdown_notifier_.reset();
+ shutdown_subscription_ = {};
}
// static
diff --git a/chrome/browser/plugins/plugin_info_host_impl.h b/chrome/browser/plugins/plugin_info_host_impl.h
index b09fadd..9b984d5 100644
--- a/chrome/browser/plugins/plugin_info_host_impl.h
+++ b/chrome/browser/plugins/plugin_info_host_impl.h
@@ -130,8 +130,7 @@
std::unique_ptr<PluginMetadata> plugin_metadata);
Context context_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_subscription_;
base::WeakPtrFactory<PluginInfoHostImpl> weak_factory_{this};
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
index 8d7f4a90..ca5858b 100644
--- a/chrome/browser/printing/printing_message_filter.cc
+++ b/chrome/browser/printing/printing_message_filter.cc
@@ -71,7 +71,7 @@
render_process_id_(render_process_id),
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_.get());
- printing_shutdown_notifier_ =
+ printing_shutdown_subscription_ =
PrintingMessageFilterShutdownNotifierFactory::GetInstance()
->Get(profile)
->Subscribe(base::Bind(&PrintingMessageFilter::ShutdownOnUIThread,
@@ -87,7 +87,7 @@
void PrintingMessageFilter::ShutdownOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
is_printing_enabled_.Destroy();
- printing_shutdown_notifier_.reset();
+ printing_shutdown_subscription_ = {};
}
void PrintingMessageFilter::OnDestruct() const {
diff --git a/chrome/browser/printing/printing_message_filter.h b/chrome/browser/printing/printing_message_filter.h
index 9d6a8900..ec7bda04 100644
--- a/chrome/browser/printing/printing_message_filter.h
+++ b/chrome/browser/printing/printing_message_filter.h
@@ -59,8 +59,7 @@
void OnCheckForCancel(const mojom::PreviewIds& ids, bool* cancel);
#endif
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- printing_shutdown_notifier_;
+ base::CallbackListSubscription printing_shutdown_subscription_;
BooleanPrefMember is_printing_enabled_;
diff --git a/chrome/browser/profile_resetter/profile_resetter.cc b/chrome/browser/profile_resetter/profile_resetter.cc
index 7ec5f54..e79f798 100644
--- a/chrome/browser/profile_resetter/profile_resetter.cc
+++ b/chrome/browser/profile_resetter/profile_resetter.cc
@@ -163,7 +163,7 @@
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
std::move(callback_));
master_settings_.reset();
- template_url_service_sub_.reset();
+ template_url_service_subscription_ = {};
}
}
@@ -190,9 +190,10 @@
MarkAsDone(DEFAULT_SEARCH_ENGINE);
} else {
- template_url_service_sub_ = template_url_service_->RegisterOnLoadedCallback(
- base::BindRepeating(&ProfileResetter::OnTemplateURLServiceLoaded,
- weak_ptr_factory_.GetWeakPtr()));
+ template_url_service_subscription_ =
+ template_url_service_->RegisterOnLoadedCallback(
+ base::BindRepeating(&ProfileResetter::OnTemplateURLServiceLoaded,
+ weak_ptr_factory_.GetWeakPtr()));
template_url_service_->Load();
}
}
@@ -361,7 +362,7 @@
// TemplateURLService has loaded. If we need to clean search engines, it's
// time to go on.
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- template_url_service_sub_.reset();
+ template_url_service_subscription_ = {};
if (pending_reset_flags_ & DEFAULT_SEARCH_ENGINE)
ResetDefaultSearchEngine();
}
diff --git a/chrome/browser/profile_resetter/profile_resetter.h b/chrome/browser/profile_resetter/profile_resetter.h
index 7ebaf6d..79a7e995 100644
--- a/chrome/browser/profile_resetter/profile_resetter.h
+++ b/chrome/browser/profile_resetter/profile_resetter.h
@@ -114,7 +114,7 @@
// of deleting itself when done.
content::BrowsingDataRemover* cookies_remover_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_service_sub_;
+ base::CallbackListSubscription template_url_service_subscription_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc
index b0f5182..1f3fb61 100644
--- a/chrome/browser/profiles/host_zoom_map_browsertest.cc
+++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
@@ -78,7 +78,7 @@
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
std::vector<std::string> changed_hosts_;
- std::unique_ptr<content::HostZoomMap::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(ZoomLevelChangeObserver);
};
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index 7725d4e..4e2b731 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -151,9 +151,8 @@
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs_;
#if !defined(OS_ANDROID)
- std::unique_ptr<content::HostZoomMap::Subscription> track_zoom_subscription_;
- std::unique_ptr<ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
- parent_default_zoom_level_subscription_;
+ base::CallbackListSubscription track_zoom_subscription_;
+ base::CallbackListSubscription parent_default_zoom_level_subscription_;
#endif // !defined(OS_ANDROID)
ProfileIODataHandle io_data_;
diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc b/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
index 3fbacab..4eb38c5 100644
--- a/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
+++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
@@ -259,6 +259,6 @@
if (!log->is_popup_open)
return;
- omnibox_url_opened_subscription_.reset();
+ omnibox_url_opened_subscription_ = {};
std::move(on_omnibox_search_callback_).Run();
}
diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate.h b/chrome/browser/rlz/chrome_rlz_tracker_delegate.h
index f8a097e..3904b54b 100644
--- a/chrome/browser/rlz/chrome_rlz_tracker_delegate.h
+++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate.h
@@ -62,8 +62,7 @@
// Subscription for receiving callbacks that a URL was opened from the
// omnibox.
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- omnibox_url_opened_subscription_;
+ base::CallbackListSubscription omnibox_url_opened_subscription_;
DISALLOW_COPY_AND_ASSIGN(ChromeRLZTrackerDelegate);
};
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.h b/chrome/browser/safe_browsing/certificate_reporting_service.h
index 83d8274..cb32b80f 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service.h
+++ b/chrome/browser/safe_browsing/certificate_reporting_service.h
@@ -218,11 +218,10 @@
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
std::unique_ptr<Reporter> reporter_;
- // Subscription for state changes. When this subscription is notified, it
+ // Subscription for state changes. When the callback is notified, it
// means SafeBrowsingService is enabled/disabled or one of the preferences
// related to it is changed.
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- safe_browsing_state_subscription_;
+ base::CallbackListSubscription safe_browsing_state_subscription_;
// Maximum number of reports to be queued for retry.
const size_t max_queued_report_count_;
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service.h b/chrome/browser/safe_browsing/chrome_password_protection_service.h
index ac7b318..d5f6eaa 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service.h
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service.h
@@ -570,11 +570,9 @@
std::set<content::WebContents*>
web_contents_with_unhandled_enterprise_reuses_;
- // Subscription for state changes. When this subscription is notified, it
- // means HashPasswordManager password data list has changed.
- std::unique_ptr<base::RepeatingCallbackList<void(
- const std::string& username)>::Subscription>
- hash_password_manager_subscription_;
+ // Subscription for state changes. When the callback is notified, it means
+ // HashPasswordManager password data list has changed.
+ base::CallbackListSubscription hash_password_manager_subscription_;
// Reference to the current profile's VerdictCacheManager. This is unowned.
VerdictCacheManager* cache_manager_;
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc
index ab0a592..b950deb 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc
@@ -171,9 +171,7 @@
protected:
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_adaptor_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
base::test::ScopedFeatureList feature_list_;
DISALLOW_COPY_AND_ASSIGN(ChromePasswordProtectionServiceBrowserTest);
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
index 32b21dc9..9a4e1e38 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.cc
@@ -290,21 +290,21 @@
request_copy->Start();
}
-ClientDownloadRequestSubscription
+base::CallbackListSubscription
DownloadProtectionService::RegisterClientDownloadRequestCallback(
const ClientDownloadRequestCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return client_download_request_callbacks_.Add(callback);
}
-NativeFileSystemWriteRequestSubscription
+base::CallbackListSubscription
DownloadProtectionService::RegisterNativeFileSystemWriteRequestCallback(
const NativeFileSystemWriteRequestCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return native_file_system_write_request_callbacks_.Add(callback);
}
-PPAPIDownloadRequestSubscription
+base::CallbackListSubscription
DownloadProtectionService::RegisterPPAPIDownloadRequestCallback(
const PPAPIDownloadRequestCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.h b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
index c0aec81..aa9a645 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service.h
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
@@ -156,18 +156,17 @@
// Registers a callback that will be run when a ClientDownloadRequest has
// been formed.
- ClientDownloadRequestSubscription RegisterClientDownloadRequestCallback(
+ base::CallbackListSubscription RegisterClientDownloadRequestCallback(
const ClientDownloadRequestCallback& callback);
// Registers a callback that will be run when a NativeFileSystemWriteRequest
// has been formed.
- NativeFileSystemWriteRequestSubscription
- RegisterNativeFileSystemWriteRequestCallback(
+ base::CallbackListSubscription RegisterNativeFileSystemWriteRequestCallback(
const NativeFileSystemWriteRequestCallback& callback);
// Registers a callback that will be run when a PPAPI ClientDownloadRequest
// has been formed.
- PPAPIDownloadRequestSubscription RegisterPPAPIDownloadRequestCallback(
+ base::CallbackListSubscription RegisterPPAPIDownloadRequestCallback(
const PPAPIDownloadRequestCallback& callback);
double whitelist_sample_rate() const { return whitelist_sample_rate_; }
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
index a3f272e..50cf7f0 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -378,9 +378,9 @@
void TearDown() override {
enterprise_connectors::ConnectorsManager::GetInstance()
->TearDownForTesting();
- client_download_request_subscription_.reset();
- ppapi_download_request_subscription_.reset();
- native_file_system_write_request_subscription_.reset();
+ client_download_request_subscription_ = {};
+ ppapi_download_request_subscription_ = {};
+ native_file_system_write_request_subscription_ = {};
sb_service_->ShutDown();
// Flush all of the thread message loops to ensure that there are no
// tasks currently running.
@@ -716,10 +716,9 @@
std::unique_ptr<content::InProcessUtilityThreadHelper>
in_process_utility_thread_helper_;
base::FilePath testdata_path_;
- ClientDownloadRequestSubscription client_download_request_subscription_;
- PPAPIDownloadRequestSubscription ppapi_download_request_subscription_;
- NativeFileSystemWriteRequestSubscription
- native_file_system_write_request_subscription_;
+ base::CallbackListSubscription client_download_request_subscription_;
+ base::CallbackListSubscription ppapi_download_request_subscription_;
+ base::CallbackListSubscription native_file_system_write_request_subscription_;
std::unique_ptr<ClientDownloadRequest> last_client_download_request_;
// The following 5 fields are used by PrepareBasicDownloadItem() function to
// store attributes of the last download item. They can be modified
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_util.h b/chrome/browser/safe_browsing/download_protection/download_protection_util.h
index 5ce5adc..124a034 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_util.h
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_util.h
@@ -118,8 +118,6 @@
const ClientDownloadRequest*)>;
using ClientDownloadRequestCallback =
ClientDownloadRequestCallbackList::CallbackType;
-using ClientDownloadRequestSubscription =
- std::unique_ptr<ClientDownloadRequestCallbackList::Subscription>;
// Callbacks run on the main thread when a NativeFileSystemWriteRequest has been
// formed for a write operation.
@@ -127,8 +125,6 @@
base::RepeatingCallbackList<void(const ClientDownloadRequest*)>;
using NativeFileSystemWriteRequestCallback =
NativeFileSystemWriteRequestCallbackList::CallbackType;
-using NativeFileSystemWriteRequestSubscription =
- std::unique_ptr<NativeFileSystemWriteRequestCallbackList::Subscription>;
// Callbacks run on the main thread when a PPAPI ClientDownloadRequest has been
// formed for a download.
@@ -136,8 +132,6 @@
base::RepeatingCallbackList<void(const ClientDownloadRequest*)>;
using PPAPIDownloadRequestCallback =
PPAPIDownloadRequestCallbackList::CallbackType;
-using PPAPIDownloadRequestSubscription =
- std::unique_ptr<PPAPIDownloadRequestCallbackList::Subscription>;
void RecordCountOfWhitelistedDownload(WhitelistType type);
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
index 50b6527..cf52e63 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
@@ -272,7 +272,7 @@
// A subscription for ClientDownloadRequests, used to persist them for later
// use.
- ClientDownloadRequestSubscription client_download_request_subscription_;
+ base::CallbackListSubscription client_download_request_subscription_;
// True when the asynchronous environment collection task has been fired off
// but has not yet completed.
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 7178d70..824dd16e 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -416,8 +416,7 @@
observed_profiles_.Add(profile);
}
-std::unique_ptr<SafeBrowsingService::StateSubscription>
-SafeBrowsingService::RegisterStateCallback(
+base::CallbackListSubscription SafeBrowsingService::RegisterStateCallback(
const base::RepeatingClosure& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return state_callback_list_.Add(callback);
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index 3b9196df9..2321be1 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -177,7 +177,7 @@
// Adds a listener for when SafeBrowsing preferences might have changed.
// To get the current state, the callback should call enabled_by_prefs().
// Should only be called on the UI thread.
- virtual std::unique_ptr<StateSubscription> RegisterStateCallback(
+ virtual base::CallbackListSubscription RegisterStateCallback(
const base::RepeatingClosure& callback);
// Sends serialized download report to backend.
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_service.cc b/chrome/browser/safe_browsing/test_safe_browsing_service.cc
index 9aa55ed..c65d292 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/test_safe_browsing_service.cc
@@ -48,13 +48,12 @@
return &test_url_loader_factory_;
}
-std::unique_ptr<SafeBrowsingService::StateSubscription>
-TestSafeBrowsingService::RegisterStateCallback(
+base::CallbackListSubscription TestSafeBrowsingService::RegisterStateCallback(
const base::RepeatingClosure& callback) {
// This override is required since TestSafeBrowsingService can be destroyed
// before CertificateReportingService, which causes a crash due to the
// leftover callback at destruction time.
- return nullptr;
+ return {};
}
std::string TestSafeBrowsingService::serilized_download_report() {
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_service.h b/chrome/browser/safe_browsing/test_safe_browsing_service.h
index 4abfdcd..d9d24ab 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/test_safe_browsing_service.h
@@ -69,7 +69,7 @@
// TestURLLoaderFactory for mocking network traffic.
void SetUseTestUrlLoaderFactory(bool use_test_url_loader_factory);
- std::unique_ptr<SafeBrowsingService::StateSubscription> RegisterStateCallback(
+ base::CallbackListSubscription RegisterStateCallback(
const base::RepeatingClosure& callback) override;
network::TestURLLoaderFactory* GetTestUrlLoaderFactory();
diff --git a/chrome/browser/search_engines/template_url_scraper_browsertest.cc b/chrome/browser/search_engines/template_url_scraper_browsertest.cc
index 1bfc2fb..3a086298 100644
--- a/chrome/browser/search_engines/template_url_scraper_browsertest.cc
+++ b/chrome/browser/search_engines/template_url_scraper_browsertest.cc
@@ -45,7 +45,7 @@
scoped_refptr<content::MessageLoopRunner> message_loop_runner =
new content::MessageLoopRunner;
- std::unique_ptr<TemplateURLService::Subscription> subscription =
+ base::CallbackListSubscription subscription =
model_->RegisterOnLoadedCallback(
base::BindLambdaForTesting([&]() { message_loop_runner->Quit(); }));
model_->Load();
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index db065091..f1eb2592 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -850,7 +850,7 @@
}
// static
-SessionRestore::CallbackSubscription
+base::CallbackListSubscription
SessionRestore::RegisterOnSessionRestoredCallback(
const base::RepeatingCallback<void(int)>& callback) {
return on_session_restored_callbacks()->Add(callback);
diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h
index 14843c9..55b135d3 100644
--- a/chrome/browser/sessions/session_restore.h
+++ b/chrome/browser/sessions/session_restore.h
@@ -52,11 +52,6 @@
// Notification callback list.
using CallbackList = base::RepeatingCallbackList<void(int)>;
- // Used by objects calling RegisterOnSessionRestoredCallback() to de-register
- // themselves when they are destroyed.
- using CallbackSubscription =
- std::unique_ptr<base::RepeatingCallbackList<void(int)>::Subscription>;
-
// Restores the last session. |behavior| is a bitmask of Behaviors, see it
// for details. If |browser| is non-null the tabs for the first window are
// added to it. Returns the last active browser.
@@ -102,7 +97,7 @@
// Note that 'complete' means all the browsers and tabs have been created but
// have not necessarily finished loading. The integer supplied to the callback
// indicates the number of tabs that were created.
- static CallbackSubscription RegisterOnSessionRestoredCallback(
+ static base::CallbackListSubscription RegisterOnSessionRestoredCallback(
const base::RepeatingCallback<void(int)>& callback);
// Add/remove an observer to/from this session restore.
diff --git a/chrome/browser/sessions/session_restore_test_helper.h b/chrome/browser/sessions/session_restore_test_helper.h
index 8985cf4..ec91ef9 100644
--- a/chrome/browser/sessions/session_restore_test_helper.h
+++ b/chrome/browser/sessions/session_restore_test_helper.h
@@ -40,7 +40,7 @@
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
// For automatically unsubscribing from callback-based notifications.
- SessionRestore::CallbackSubscription callback_subscription_;
+ base::CallbackListSubscription callback_subscription_;
// For safely binding pointers to callbacks.
base::WeakPtrFactory<SessionRestoreTestHelper> weak_ptr_factory{this};
diff --git a/chrome/browser/sharing/sharing_device_source_sync.cc b/chrome/browser/sharing/sharing_device_source_sync.cc
index 617312c..919ceab 100644
--- a/chrome/browser/sharing/sharing_device_source_sync.cc
+++ b/chrome/browser/sharing/sharing_device_source_sync.cc
@@ -144,7 +144,7 @@
void SharingDeviceSourceSync::OnLocalDeviceInfoProviderReady() {
DCHECK(local_device_info_provider_->GetLocalDeviceInfo());
- local_device_info_ready_subscription_.reset();
+ local_device_info_ready_subscription_ = {};
MaybeRunReadyCallbacks();
}
diff --git a/chrome/browser/sharing/sharing_device_source_sync.h b/chrome/browser/sharing/sharing_device_source_sync.h
index 627aeba..1b8597a 100644
--- a/chrome/browser/sharing/sharing_device_source_sync.h
+++ b/chrome/browser/sharing/sharing_device_source_sync.h
@@ -61,8 +61,7 @@
syncer::SyncService* sync_service_;
syncer::LocalDeviceInfoProvider* local_device_info_provider_;
syncer::DeviceInfoTracker* device_info_tracker_;
- std::unique_ptr<syncer::LocalDeviceInfoProvider::Subscription>
- local_device_info_ready_subscription_;
+ base::CallbackListSubscription local_device_info_ready_subscription_;
// The personalized name is stored for deduplicating devices running older
// clients.
diff --git a/chrome/browser/signin/dice_signed_in_profile_creator.cc b/chrome/browser/signin/dice_signed_in_profile_creator.cc
index 19521dd..6227a46 100644
--- a/chrome/browser/signin/dice_signed_in_profile_creator.cc
+++ b/chrome/browser/signin/dice_signed_in_profile_creator.cc
@@ -74,14 +74,14 @@
// signin::IdentityManager::Observer implementation:
void OnRefreshTokensLoaded() override {
- shutdown_subscription_.reset();
+ shutdown_subscription_ = {};
scoped_identity_manager_observer_.RemoveAll();
std::move(callback_).Run(profile_);
}
void OnShutdown() {
scoped_identity_manager_observer_.RemoveAll();
- shutdown_subscription_.reset();
+ shutdown_subscription_ = {};
std::move(callback_).Run(nullptr);
}
@@ -90,8 +90,7 @@
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
scoped_identity_manager_observer_{this};
base::OnceCallback<void(Profile*)> callback_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_subscription_;
+ base::CallbackListSubscription shutdown_subscription_;
};
// static
diff --git a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc
index 6680c25d1..67ca620e 100644
--- a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc
+++ b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc
@@ -220,9 +220,7 @@
network::TestURLLoaderFactory test_url_loader_factory_;
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_profile_adaptor_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
std::map<content::BrowserContext*, FakeDiceWebSigninInterceptorDelegate*>
interceptor_delegates_;
};
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h b/chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h
index 2519479..7742934 100644
--- a/chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h
@@ -66,8 +66,7 @@
std::set<std::string> engine_extension_ids_;
- std::unique_ptr<chromeos::AccessibilityStatusSubscription>
- accessibility_status_subscription_;
+ base::CallbackListSubscription accessibility_status_subscription_;
mojo::Remote<chromeos::tts::mojom::TtsService> tts_service_;
diff --git a/chrome/browser/ssl/sct_reporting_service.h b/chrome/browser/ssl/sct_reporting_service.h
index c260c12b..f1c8b37 100644
--- a/chrome/browser/ssl/sct_reporting_service.h
+++ b/chrome/browser/ssl/sct_reporting_service.h
@@ -44,8 +44,7 @@
safe_browsing::SafeBrowsingService* safe_browsing_service_;
const PrefService& pref_service_;
Profile* profile_;
- std::unique_ptr<base::CallbackList<void(void)>::Subscription>
- safe_browsing_state_subscription_;
+ base::CallbackListSubscription safe_browsing_state_subscription_;
};
#endif // CHROME_BROWSER_SSL_SCT_REPORTING_SERVICE_H_
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.cc b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
index e7b92c83..56fc007 100644
--- a/chrome/browser/supervised_user/child_accounts/child_account_service.cc
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
@@ -143,8 +143,7 @@
: AuthState::NOT_AUTHENTICATED;
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
-ChildAccountService::ObserveGoogleAuthState(
+base::CallbackListSubscription ChildAccountService::ObserveGoogleAuthState(
const base::Callback<void()>& callback) {
return google_auth_state_observers_.Add(callback);
}
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.h b/chrome/browser/supervised_user/child_accounts/child_account_service.h
index aaa13cc..21f9f6f 100644
--- a/chrome/browser/supervised_user/child_accounts/child_account_service.h
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service.h
@@ -63,8 +63,8 @@
// Subscribes to changes to the Google authentication state
// (see IsGoogleAuthenticated()). Can send a notification even if the
// authentication state has not changed.
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- ObserveGoogleAuthState(const base::Callback<void()>& callback);
+ base::CallbackListSubscription ObserveGoogleAuthState(
+ const base::Callback<void()>& callback);
private:
friend class ChildAccountServiceFactory;
diff --git a/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc b/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc
index ea24524d..3e15e5d 100644
--- a/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc
+++ b/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc
@@ -93,7 +93,7 @@
switch (result.action()) {
case content::NavigationThrottle::PROCEED: {
- google_auth_state_subscription_.reset();
+ google_auth_state_subscription_ = {};
Resume();
break;
}
diff --git a/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.h b/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.h
index 6c5fe61..bb1758a 100644
--- a/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.h
+++ b/chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.h
@@ -45,8 +45,7 @@
void OnReauthenticationResult(bool reauth_successful);
ChildAccountService* child_account_service_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- google_auth_state_subscription_;
+ base::CallbackListSubscription google_auth_state_subscription_;
#if defined(OS_ANDROID)
bool has_shown_reauth_;
diff --git a/chrome/browser/supervised_user/supervised_user_pref_store.cc b/chrome/browser/supervised_user/supervised_user_pref_store.cc
index e399212..a860d917 100644
--- a/chrome/browser/supervised_user/supervised_user_pref_store.cc
+++ b/chrome/browser/supervised_user/supervised_user_pref_store.cc
@@ -73,8 +73,8 @@
base::Unretained(this)));
// The SupervisedUserSettingsService must be created before the PrefStore, and
- // it will notify the PrefStore to unsubscribe both subscriptions when it is
- // shut down.
+ // it will notify the PrefStore to destroy both subscriptions when it is shut
+ // down.
shutdown_subscription_ =
supervised_user_settings_service->SubscribeForShutdown(
base::BindRepeating(
@@ -191,6 +191,6 @@
}
void SupervisedUserPrefStore::OnSettingsServiceShutdown() {
- user_settings_subscription_.reset();
- shutdown_subscription_.reset();
+ user_settings_subscription_ = {};
+ shutdown_subscription_ = {};
}
diff --git a/chrome/browser/supervised_user/supervised_user_pref_store.h b/chrome/browser/supervised_user/supervised_user_pref_store.h
index ccac400..fa34b3e 100644
--- a/chrome/browser/supervised_user/supervised_user_pref_store.h
+++ b/chrome/browser/supervised_user/supervised_user_pref_store.h
@@ -45,12 +45,9 @@
void OnSettingsServiceShutdown();
- std::unique_ptr<
- base::CallbackList<void(const base::DictionaryValue*)>::Subscription>
- user_settings_subscription_;
+ base::CallbackListSubscription user_settings_subscription_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- shutdown_subscription_;
+ base::CallbackListSubscription shutdown_subscription_;
std::unique_ptr<PrefValueMap> prefs_;
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc
index 4cb5f9f0..0460c14d 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -87,8 +87,7 @@
store_->AddObserver(this);
}
-std::unique_ptr<
- SupervisedUserSettingsService::SettingsCallbackList::Subscription>
+base::CallbackListSubscription
SupervisedUserSettingsService::SubscribeForSettingsChange(
const SettingsCallback& callback) {
if (IsReady()) {
@@ -99,8 +98,7 @@
return settings_callback_list_.Add(callback);
}
-std::unique_ptr<
- SupervisedUserSettingsService::ShutdownCallbackList::Subscription>
+base::CallbackListSubscription
SupervisedUserSettingsService::SubscribeForShutdown(
const ShutdownCallback& callback) {
return shutdown_callback_list_.Add(callback);
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.h b/chrome/browser/supervised_user/supervised_user_settings_service.h
index f7a2ea1..4b3a24ce 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.h
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.h
@@ -83,13 +83,12 @@
// Adds a callback to be called when supervised user settings are initially
// available, or when they change.
- std::unique_ptr<SettingsCallbackList::Subscription>
- SubscribeForSettingsChange(const SettingsCallback& callback)
- WARN_UNUSED_RESULT;
+ base::CallbackListSubscription SubscribeForSettingsChange(
+ const SettingsCallback& callback) WARN_UNUSED_RESULT;
// Subscribe for a notification when the keyed service is shut down. The
- // subscription object can be destroyed to unsubscribe.
- std::unique_ptr<ShutdownCallbackList::Subscription> SubscribeForShutdown(
+ // subscription can be destroyed to unsubscribe.
+ base::CallbackListSubscription SubscribeForShutdown(
const ShutdownCallback& callback);
// Activates/deactivates the service. This is called by the
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
index 0695b74..38cedd7ba 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
@@ -139,9 +139,7 @@
std::unique_ptr<base::Value> atomic_setting_value_;
SupervisedUserSettingsService settings_service_;
std::unique_ptr<base::DictionaryValue> settings_;
- std::unique_ptr<
- base::CallbackList<void(const base::DictionaryValue*)>::Subscription>
- user_settings_subscription_;
+ base::CallbackListSubscription user_settings_subscription_;
std::unique_ptr<syncer::FakeSyncChangeProcessor> sync_processor_;
};
diff --git a/chrome/browser/sync/test/integration/password_manager_sync_test.cc b/chrome/browser/sync/test/integration/password_manager_sync_test.cc
index eb3ad7e..b8ea128 100644
--- a/chrome/browser/sync/test/integration/password_manager_sync_test.cc
+++ b/chrome/browser/sync/test/integration/password_manager_sync_test.cc
@@ -157,7 +157,7 @@
void SetUpInProcessBrowserTestFixture() override {
SyncTest::SetUpInProcessBrowserTestFixture();
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
mock_cert_verifier_.SetUpInProcessBrowserTestFixture();
}
@@ -356,8 +356,7 @@
base::test::ScopedFeatureList feature_list_;
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
// A test server instance that runs on HTTPS (as opposed to the default
// |embedded_test_server()|). This is necessary to simulate Gaia pages, which
diff --git a/chrome/browser/sync/test/integration/secondary_account_helper.cc b/chrome/browser/sync/test/integration/secondary_account_helper.cc
index ea458b4..9802abc 100644
--- a/chrome/browser/sync/test/integration/secondary_account_helper.cc
+++ b/chrome/browser/sync/test/integration/secondary_account_helper.cc
@@ -35,7 +35,7 @@
} // namespace
-ScopedSigninClientFactory SetUpSigninClient(
+base::CallbackListSubscription SetUpSigninClient(
network::TestURLLoaderFactory* test_url_loader_factory) {
return BrowserContextDependencyManager::GetInstance()
->RegisterCreateServicesCallbackForTesting(base::BindRepeating(
diff --git a/chrome/browser/sync/test/integration/secondary_account_helper.h b/chrome/browser/sync/test/integration/secondary_account_helper.h
index 3c20a798..b938cc6 100644
--- a/chrome/browser/sync/test/integration/secondary_account_helper.h
+++ b/chrome/browser/sync/test/integration/secondary_account_helper.h
@@ -20,15 +20,12 @@
namespace secondary_account_helper {
-using ScopedSigninClientFactory = std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>;
-
// Sets up a factory to create a SigninClient which uses the
// provided |test_url_loader_factory| for cookie-related requests. Meant to be
// called from SetUpInProcessBrowserTestFixture. The caller should hold on to
// the returned object for the duration of the test, e.g. store it in a member
// of the test fixture class.
-ScopedSigninClientFactory SetUpSigninClient(
+base::CallbackListSubscription SetUpSigninClient(
network::TestURLLoaderFactory* test_url_loader_factory);
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc
index 1b74589..b4a9d463 100644
--- a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc
@@ -231,7 +231,7 @@
~SingleClientPasswordsWithAccountStorageSyncTest() override = default;
void SetUpInProcessBrowserTestFixture() override {
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
}
@@ -262,8 +262,7 @@
private:
base::test::ScopedFeatureList feature_list_;
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
DISALLOW_COPY_AND_ASSIGN(SingleClientPasswordsWithAccountStorageSyncTest);
};
diff --git a/chrome/browser/sync/test/integration/single_client_secondary_account_sync_test.cc b/chrome/browser/sync/test/integration/single_client_secondary_account_sync_test.cc
index d7defa28..6c37574 100644
--- a/chrome/browser/sync/test/integration/single_client_secondary_account_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_secondary_account_sync_test.cc
@@ -47,7 +47,7 @@
~SingleClientSecondaryAccountSyncTest() override {}
void SetUpInProcessBrowserTestFixture() override {
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
}
@@ -63,8 +63,7 @@
private:
base::test::ScopedFeatureList features_;
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
DISALLOW_COPY_AND_ASSIGN(SingleClientSecondaryAccountSyncTest);
};
diff --git a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
index 1acec1e1..0e25317 100644
--- a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
@@ -236,9 +236,7 @@
Profile* const profile_;
const GURL page_url_;
const bool should_be_available_;
- std::unique_ptr<
- history::HistoryService::FaviconsChangedCallbackList::Subscription>
- callback_subscription_;
+ base::CallbackListSubscription callback_subscription_;
bool exit_condition_satisfied_ = false;
base::CancelableTaskTracker tracker_;
};
diff --git a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc
index 220c7be..896f3038 100644
--- a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc
@@ -1203,7 +1203,7 @@
~SingleClientWalletSecondaryAccountSyncTest() override {}
void SetUpInProcessBrowserTestFixture() override {
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
}
@@ -1219,8 +1219,7 @@
private:
base::test::ScopedFeatureList features_;
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
DISALLOW_COPY_AND_ASSIGN(SingleClientWalletSecondaryAccountSyncTest);
};
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h
index 05c2731..d6c6f2b 100644
--- a/chrome/browser/sync/test/integration/sync_test.h
+++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -506,9 +506,7 @@
// Triggers a GetUpdates via refresh after a configuration.
std::unique_ptr<ConfigurationRefresher> configuration_refresher_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
// Sync profile against which changes to individual profiles are verified.
// We don't need a corresponding verifier sync client because the contents
diff --git a/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.cc b/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.cc
index d90884a0b..bfd28cb 100644
--- a/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.cc
+++ b/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.cc
@@ -46,7 +46,7 @@
void SpareRenderProcessHostTaskProvider::StopUpdating() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- subscription_.reset();
+ subscription_ = {};
task_.reset();
}
diff --git a/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.h b/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.h
index dc515f3..d1343da 100644
--- a/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.h
+++ b/chrome/browser/task_manager/providers/spare_render_process_host_task_provider.h
@@ -41,10 +41,8 @@
// no current spare render process host.
std::unique_ptr<ChildProcessTask> task_;
- // The subscription to the notifications of the spare host changing.
- std::unique_ptr<
- base::CallbackList<void(content::RenderProcessHost*)>::Subscription>
- subscription_;
+ // The subscription for the notifications of the spare host changing.
+ base::CallbackListSubscription subscription_;
};
} // namespace task_manager
diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc
index 2d044a8..cb56c77 100644
--- a/chrome/browser/translate/translate_manager_browsertest.cc
+++ b/chrome/browser/translate/translate_manager_browsertest.cc
@@ -359,8 +359,7 @@
base::test::ScopedFeatureList scoped_feature_list_;
TranslateErrors::Type error_type_;
- std::unique_ptr<TranslateManager::TranslateErrorCallbackList::Subscription>
- error_subscription_;
+ base::CallbackListSubscription error_subscription_;
std::unique_ptr<TranslateWaiter> language_determined_waiter_;
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc
index eab9d09..2f7ccdc 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -408,8 +408,7 @@
// comments for the apps::IconCache::GarbageCollectionPolicy enum.
apps::IconCache icon_cache_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- foreign_session_updated_subscription_;
+ base::CallbackListSubscription foreign_session_updated_subscription_;
DISALLOW_COPY_AND_ASSIGN(AppServiceDataSource);
};
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.cc b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.cc
index e5a1e996..218c051 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.cc
@@ -28,7 +28,7 @@
void AppListLaunchMetricsProvider::OnRecordingDisabled() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- subscription_.reset();
+ subscription_ = {};
}
void AppListLaunchMetricsProvider::Initialize() {
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.h b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.h
index 36cd84a..12674e57 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.h
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider.h
@@ -65,8 +65,8 @@
// Performs initialization once a user has logged in.
void Initialize();
- // Subscription for receiving logging event callbacks from HashedLogger.
- std::unique_ptr<AppListLaunchRecorder::LaunchEventSubscription> subscription_;
+ // Subscription for logging event callbacks from HashedLogger.
+ base::CallbackListSubscription subscription_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.cc b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.cc
index f1dc0da..0041a96 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.cc
@@ -23,8 +23,8 @@
AppListLaunchRecorder::AppListLaunchRecorder() = default;
AppListLaunchRecorder::~AppListLaunchRecorder() = default;
-std::unique_ptr<AppListLaunchRecorder::LaunchEventSubscription>
-AppListLaunchRecorder::RegisterCallback(const LaunchEventCallback& callback) {
+base::CallbackListSubscription AppListLaunchRecorder::RegisterCallback(
+ const LaunchEventCallback& callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return callback_list_.Add(callback);
}
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.h b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.h
index abcee868..f5bfc74 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.h
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_recorder.h
@@ -62,7 +62,6 @@
using EventFn = void(const LaunchInfo&);
using LaunchEventCallback = base::RepeatingCallback<EventFn>;
using LaunchEventCallbackList = base::CallbackList<EventFn>;
- using LaunchEventSubscription = LaunchEventCallbackList::Subscription;
AppListLaunchRecorder();
~AppListLaunchRecorder();
@@ -94,7 +93,7 @@
}
// Registers a callback to be invoked on a call to Log().
- std::unique_ptr<LaunchEventSubscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const LaunchEventCallback& callback);
LaunchEventCallbackList callback_list_;
diff --git a/chrome/browser/ui/ash/wallpaper_controller_client.h b/chrome/browser/ui/ash/wallpaper_controller_client.h
index ce9a2b8c..0c7fbe7d 100644
--- a/chrome/browser/ui/ash/wallpaper_controller_client.h
+++ b/chrome/browser/ui/ash/wallpaper_controller_client.h
@@ -121,10 +121,10 @@
// The registrar used to watch DeviceWallpaperImageFilePath pref changes.
PrefChangeRegistrar pref_registrar_;
- // Observes if user names should be shown on the login screen, which
- // determines whether a user wallpaper or a default wallpaper should be shown.
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- show_user_names_on_signin_subscription_;
+ // Subscription for a callback that monitors if user names should be shown on
+ // the login screen, which determines whether a user wallpaper or a default
+ // wallpaper should be shown.
+ base::CallbackListSubscription show_user_names_on_signin_subscription_;
base::WeakPtrFactory<WallpaperControllerClient> weak_factory_{this};
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index b454c034..3cd19bd 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -1840,12 +1840,12 @@
base::OnceClosure quit_closure = loop_runner->QuitClosure();
content::HostZoomMap::ZoomLevelChangedCallback callback =
base::BindRepeating(&OnZoomLevelChanged, &quit_closure);
- std::unique_ptr<content::HostZoomMap::Subscription> sub =
+ base::CallbackListSubscription subscription =
content::HostZoomMap::GetDefaultForBrowserContext(browser()->profile())
->AddZoomLevelChangedCallback(std::move(callback));
chrome::Zoom(browser(), content::PAGE_ZOOM_IN);
loop_runner->Run();
- sub.reset();
+ subscription = {};
EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 110);
EXPECT_TRUE(enable_plus);
EXPECT_TRUE(enable_minus);
@@ -1857,12 +1857,12 @@
base::OnceClosure quit_closure = loop_runner->QuitClosure();
content::HostZoomMap::ZoomLevelChangedCallback callback =
base::BindRepeating(&OnZoomLevelChanged, &quit_closure);
- std::unique_ptr<content::HostZoomMap::Subscription> sub =
+ base::CallbackListSubscription subscription =
content::HostZoomMap::GetDefaultForBrowserContext(browser()->profile())
->AddZoomLevelChangedCallback(std::move(callback));
chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
loop_runner->Run();
- sub.reset();
+ subscription = {};
EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 100);
EXPECT_TRUE(enable_plus);
EXPECT_TRUE(enable_minus);
@@ -1874,12 +1874,12 @@
base::OnceClosure quit_closure = loop_runner->QuitClosure();
content::HostZoomMap::ZoomLevelChangedCallback callback =
base::BindRepeating(&OnZoomLevelChanged, &quit_closure);
- std::unique_ptr<content::HostZoomMap::Subscription> sub =
+ base::CallbackListSubscription subscription =
content::HostZoomMap::GetDefaultForBrowserContext(browser()->profile())
->AddZoomLevelChangedCallback(std::move(callback));
chrome::Zoom(browser(), content::PAGE_ZOOM_OUT);
loop_runner->Run();
- sub.reset();
+ subscription = {};
EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 90);
EXPECT_TRUE(enable_plus);
EXPECT_TRUE(enable_minus);
diff --git a/chrome/browser/ui/global_media_controls/media_notification_device_monitor_unittest.cc b/chrome/browser/ui/global_media_controls/media_notification_device_monitor_unittest.cc
index 8236f779..921cd7f 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_device_monitor_unittest.cc
+++ b/chrome/browser/ui/global_media_controls/media_notification_device_monitor_unittest.cc
@@ -22,8 +22,7 @@
class MockMediaNotificationDeviceProvider
: public MediaNotificationDeviceProvider {
public:
- MOCK_METHOD(std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>,
+ MOCK_METHOD(base::CallbackListSubscription,
RegisterOutputDeviceDescriptionsCallback,
(GetOutputDevicesCallback cb),
(override));
diff --git a/chrome/browser/ui/global_media_controls/media_notification_device_provider.h b/chrome/browser/ui/global_media_controls/media_notification_device_provider.h
index 1268c554..0ab8325 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_device_provider.h
+++ b/chrome/browser/ui/global_media_controls/media_notification_device_provider.h
@@ -19,8 +19,7 @@
// Register a callback that will be invoked with the list of audio output
// devices currently available. After the first invocation the callback will
// be run whenever a change in connected audio devices is detected.
- virtual std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
+ virtual base::CallbackListSubscription
RegisterOutputDeviceDescriptionsCallback(GetOutputDevicesCallback cb) = 0;
// Query the system for audio output devices and reply via callback.
diff --git a/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.cc b/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.cc
index 4af6e9e..64062bd 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.cc
+++ b/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.cc
@@ -79,8 +79,7 @@
monitor_->RemoveDevicesChangedObserver(this);
}
-std::unique_ptr<
- MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::Subscription>
+base::CallbackListSubscription
MediaNotificationDeviceProviderImpl::RegisterOutputDeviceDescriptionsCallback(
GetOutputDevicesCallback cb) {
if (!monitor_) {
diff --git a/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h b/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h
index eb45d73..2cc972b 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h
+++ b/chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h
@@ -23,9 +23,7 @@
~MediaNotificationDeviceProviderImpl() override;
// MediaNotificationDeviceProvider
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- RegisterOutputDeviceDescriptionsCallback(
+ base::CallbackListSubscription RegisterOutputDeviceDescriptionsCallback(
GetOutputDevicesCallback cb) override;
void GetOutputDeviceDescriptions(
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.cc b/chrome/browser/ui/global_media_controls/media_notification_service.cc
index 7519878..d38fdd8 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_service.cc
+++ b/chrome/browser/ui/global_media_controls/media_notification_service.cc
@@ -250,8 +250,7 @@
controller_->SetAudioSinkId(id);
}
-std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
-MediaNotificationService::Session::
+base::CallbackListSubscription MediaNotificationService::Session::
RegisterIsAudioDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) {
callback.Run(is_audio_device_switching_supported_);
@@ -772,8 +771,7 @@
HideNotification(id);
}
-std::unique_ptr<
- MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::Subscription>
+base::CallbackListSubscription
MediaNotificationService::RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallback callback) {
if (!device_provider_)
@@ -783,7 +781,7 @@
std::move(callback));
}
-std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+base::CallbackListSubscription
MediaNotificationService::RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
const std::string& id,
base::RepeatingCallback<void(bool)> callback) {
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.h b/chrome/browser/ui/global_media_controls/media_notification_service.h
index 5b6df9e..ba7e6114 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_service.h
+++ b/chrome/browser/ui/global_media_controls/media_notification_service.h
@@ -122,15 +122,13 @@
// Used by a |MediaNotificationDeviceSelectorView| to query the system
// for connected audio output devices.
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- RegisterAudioOutputDeviceDescriptionsCallback(
+ base::CallbackListSubscription RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallback callback);
// Used by a |MediaNotificationAudioDeviceSelectorView| to become notified of
// audio device switching capabilities. The callback will be immediately run
// with the current availability.
- std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+ base::CallbackListSubscription
RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
const std::string& id,
base::RepeatingCallback<void(bool)> callback);
@@ -232,7 +230,7 @@
void SetAudioSinkId(const std::string& id);
- std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+ base::CallbackListSubscription
RegisterIsAudioDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback);
diff --git a/chrome/browser/ui/passwords/manage_passwords_test.h b/chrome/browser/ui/passwords/manage_passwords_test.h
index be85ec6..ea6b8c0 100644
--- a/chrome/browser/ui/passwords/manage_passwords_test.h
+++ b/chrome/browser/ui/passwords/manage_passwords_test.h
@@ -87,9 +87,7 @@
password_manager::StubPasswordManagerDriver driver_;
password_manager::FakeFormFetcher fetcher_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsTest);
};
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h
index 9bedc7c..1b846858 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.h
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.h
@@ -63,8 +63,7 @@
Profile* profile_;
content::NotificationRegistrar registrar_;
#if !defined(OS_ANDROID)
- std::unique_ptr<ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
- default_zoom_level_subscription_;
+ base::CallbackListSubscription default_zoom_level_subscription_;
FontPrefChangeNotifier::Registrar font_change_registrar_;
#endif // !defined(OS_ANDROID)
base::WeakPtrFactory<PrefsTabHelper> weak_ptr_factory_{this};
diff --git a/chrome/browser/ui/recently_audible_helper.cc b/chrome/browser/ui/recently_audible_helper.cc
index 42a82cb1..00a2783 100644
--- a/chrome/browser/ui/recently_audible_helper.cc
+++ b/chrome/browser/ui/recently_audible_helper.cc
@@ -39,8 +39,8 @@
return tick_clock_->NowTicks() < recently_audible_time_limit;
}
-std::unique_ptr<RecentlyAudibleHelper::Subscription>
-RecentlyAudibleHelper::RegisterCallback(const Callback& callback) {
+base::CallbackListSubscription RecentlyAudibleHelper::RegisterCallback(
+ const Callback& callback) {
return callback_list_.Add(callback);
}
diff --git a/chrome/browser/ui/recently_audible_helper.h b/chrome/browser/ui/recently_audible_helper.h
index cb971b9..e1712033 100644
--- a/chrome/browser/ui/recently_audible_helper.h
+++ b/chrome/browser/ui/recently_audible_helper.h
@@ -31,7 +31,6 @@
using CallbackList = base::CallbackList<void(bool was_recently_audible)>;
using Callback = CallbackList::CallbackType;
- using Subscription = CallbackList::Subscription;
~RecentlyAudibleHelper() override;
@@ -48,7 +47,7 @@
// Registers the provided repeating callback for notifications. Destroying
// the returned subscription will unregister the callback. This is safe to do
// while in the context of the callback itself.
- std::unique_ptr<Subscription> RegisterCallback(const Callback& callback);
+ base::CallbackListSubscription RegisterCallback(const Callback& callback);
// Allows replacing the tick clock that is used by this class. Setting it back
// to nullptr will restore the default tick clock.
diff --git a/chrome/browser/ui/recently_audible_helper_unittest.cc b/chrome/browser/ui/recently_audible_helper_unittest.cc
index 279b96e..2597ad0 100644
--- a/chrome/browser/ui/recently_audible_helper_unittest.cc
+++ b/chrome/browser/ui/recently_audible_helper_unittest.cc
@@ -44,7 +44,7 @@
void TearDown() override {
helper_->SetTickClockForTesting(nullptr);
- subscription_.reset();
+ subscription_ = {};
task_runner_->RunUntilIdle();
EXPECT_TRUE(recently_audible_messages_.empty());
@@ -115,7 +115,7 @@
// A test WebContents and its associated helper.
content::WebContents* contents_;
RecentlyAudibleHelper* helper_;
- std::unique_ptr<RecentlyAudibleHelper::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
std::list<bool> recently_audible_messages_;
diff --git a/chrome/browser/ui/search/local_ntp_doodle_browsertest.cc b/chrome/browser/ui/search/local_ntp_doodle_browsertest.cc
index 186f74e8..8fe47b0 100644
--- a/chrome/browser/ui/search/local_ntp_doodle_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_doodle_browsertest.cc
@@ -337,9 +337,7 @@
context, base::BindRepeating(&LocalNTPDoodleTest::CreateLogoService));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPDoodleTest,
diff --git a/chrome/browser/ui/search/local_ntp_one_google_bar_browsertest.cc b/chrome/browser/ui/search/local_ntp_one_google_bar_browsertest.cc
index e6dc900a..77cdf143 100644
--- a/chrome/browser/ui/search/local_ntp_one_google_bar_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_one_google_bar_browsertest.cc
@@ -90,9 +90,7 @@
&LocalNTPOneGoogleBarSmokeTest::CreateOneGoogleBarService));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPOneGoogleBarSmokeTest,
diff --git a/chrome/browser/ui/search/local_ntp_promos_browsertest.cc b/chrome/browser/ui/search/local_ntp_promos_browsertest.cc
index 3abd512..4e1a606 100644
--- a/chrome/browser/ui/search/local_ntp_promos_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_promos_browsertest.cc
@@ -89,9 +89,7 @@
context, base::BindRepeating(&LocalNTPPromoTest::CreatePromoService));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPPromoTest, PromoInjectedIntoPage) {
diff --git a/chrome/browser/ui/search/local_ntp_suggestions_browsertest.cc b/chrome/browser/ui/search/local_ntp_suggestions_browsertest.cc
index f5e36bc4..0e60e0c72 100644
--- a/chrome/browser/ui/search/local_ntp_suggestions_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_suggestions_browsertest.cc
@@ -91,9 +91,7 @@
&LocalNTPSearchSuggestTest::CreateSearchSuggestService));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPSearchSuggestTest,
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
index 8f40d04..bf07d4a 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
@@ -33,7 +33,7 @@
TemplateURLServiceObserver(TemplateURLService* service, base::RunLoop* loop)
: runner_(loop) {
DCHECK(loop);
- template_url_sub_ = service->RegisterOnLoadedCallback(base::Bind(
+ template_url_subscription_ = service->RegisterOnLoadedCallback(base::Bind(
&TemplateURLServiceObserver::StopLoop, base::Unretained(this)));
service->Load();
}
@@ -42,7 +42,7 @@
private:
void StopLoop() { runner_->Quit(); }
base::RunLoop* runner_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
+ base::CallbackListSubscription template_url_subscription_;
DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceObserver);
};
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 730c3d6..1a703e7 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -202,7 +202,7 @@
void OnSessionRestoreDone(int num_tabs_restored);
// For automatically unsubscribing from callback-based notifications.
- SessionRestore::CallbackSubscription callback_subscription_;
+ base::CallbackListSubscription callback_subscription_;
base::OnceClosure quit_closure_;
int num_session_restores_expected_;
int num_sessions_restored_ = 0;
diff --git a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
index 69e3458..6946fb33 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
@@ -109,9 +109,7 @@
context, base::BindRepeating(&BuildMockTriggeredProfileResetter));
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTriggeredResetTest,
diff --git a/chrome/browser/ui/toolbar/app_menu_model.h b/chrome/browser/ui/toolbar/app_menu_model.h
index 15283bd8..d75ba9a 100644
--- a/chrome/browser/ui/toolbar/app_menu_model.h
+++ b/chrome/browser/ui/toolbar/app_menu_model.h
@@ -231,8 +231,7 @@
Browser* const browser_; // weak
AppMenuIconController* const app_menu_icon_controller_;
- std::unique_ptr<content::HostZoomMap::Subscription>
- browser_zoom_subscription_;
+ base::CallbackListSubscription browser_zoom_subscription_;
PrefChangeRegistrar local_state_pref_change_registrar_;
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
index 911131f8..a12dd181 100644
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
@@ -184,8 +184,7 @@
sessions::TabRestoreServiceObserver>
tab_restore_service_observer_{this};
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- foreign_session_updated_subscription_;
+ base::CallbackListSubscription foreign_session_updated_subscription_;
base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_{this};
base::WeakPtrFactory<RecentTabsSubMenuModel>
diff --git a/chrome/browser/ui/views/autofill/payments/local_card_migration_browsertest.cc b/chrome/browser/ui/views/autofill/payments/local_card_migration_browsertest.cc
index 179da299..4f14252 100644
--- a/chrome/browser/ui/views/autofill/payments/local_card_migration_browsertest.cc
+++ b/chrome/browser/ui/views/autofill/payments/local_card_migration_browsertest.cc
@@ -519,10 +519,6 @@
}
}
- std::unique_ptr<
- base::CallbackList<void(content::BrowserContext*)>::Subscription>
- will_create_browser_context_services_subscription_;
-
LocalCardMigrationManager* local_card_migration_manager_;
PersonalDataManager* personal_data_;
diff --git a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc
index 8e95c61..e6ad00b1 100644
--- a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc
+++ b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc
@@ -794,10 +794,6 @@
return &test_url_loader_factory_;
}
- std::unique_ptr<
- base::CallbackList<void(content::BrowserContext*)>::Subscription>
- will_create_browser_context_services_subscription_;
-
std::unique_ptr<ProfileSyncServiceHarness> harness_;
CreditCardSaveManager* credit_card_save_manager_ = nullptr;
@@ -1130,7 +1126,7 @@
protected:
void SetUpInProcessBrowserTestFixture() override {
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(test_url_loader_factory());
SaveCardBubbleViewsFullFormBrowserTest::SetUpInProcessBrowserTestFixture();
@@ -1153,8 +1149,7 @@
private:
base::test::ScopedFeatureList feature_list_;
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
};
// Tests the upload save bubble. Ensures that clicking the [Save] button
diff --git a/chrome/browser/ui/views/cookie_info_view.cc b/chrome/browser/ui/views/cookie_info_view.cc
index 7b06243..9535e5d 100644
--- a/chrome/browser/ui/views/cookie_info_view.cc
+++ b/chrome/browser/ui/views/cookie_info_view.cc
@@ -61,7 +61,7 @@
void OnEnabledChanged() { SetCanProcessEventsWithinSubtree(GetEnabled()); }
views::ScrollView* const scroll_parent_;
- views::PropertyChangedSubscription on_enabled_subscription_;
+ base::CallbackListSubscription on_enabled_subscription_;
};
} // anonymous namespace
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h
index 6183e04..3a1314f 100644
--- a/chrome/browser/ui/views/frame/browser_frame.h
+++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -168,7 +168,7 @@
// NativeBrowserFrame::UsesNativeSystemMenu() returns false.
std::unique_ptr<views::MenuRunner> menu_runner_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&BrowserFrame::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
index 470e139e2..42a8de8 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
@@ -193,11 +193,10 @@
// Menu button and page status icons. Only used by web-app windows.
WebAppFrameToolbarView* web_app_frame_toolbar_ = nullptr;
- std::unique_ptr<views::Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_ =
- frame_->RegisterPaintAsActiveChangedCallback(base::BindRepeating(
- &BrowserNonClientFrameView::PaintAsActiveChanged,
- base::Unretained(this)));
+ base::CallbackListSubscription paint_as_active_subscription_ =
+ frame_->RegisterPaintAsActiveChangedCallback(
+ base::BindRepeating(&BrowserNonClientFrameView::PaintAsActiveChanged,
+ base::Unretained(this)));
ScopedObserver<TabStrip, TabStripObserver> tab_strip_observer_{this};
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac_browsertest.cc
index 0cf884c..d75e429 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac_browsertest.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac_browsertest.cc
@@ -56,7 +56,7 @@
bool observed_change_ = false;
base::RunLoop run_loop_;
- views::PropertyChangedSubscription subscription_;
+ base::CallbackListSubscription subscription_;
};
} // anonymous namespace
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 36632a34..bd749e8 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1518,8 +1518,7 @@
#endif
}
-BrowserView::OnLinkOpeningFromGestureSubscription
-BrowserView::AddOnLinkOpeningFromGestureCallback(
+base::CallbackListSubscription BrowserView::AddOnLinkOpeningFromGestureCallback(
OnLinkOpeningFromGestureCallback callback) {
return link_opened_from_gesture_callbacks_.Add(callback);
}
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 5af4987..4e6dc3a 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -321,14 +321,12 @@
base::RepeatingCallback<void(WindowOpenDisposition)>;
using OnLinkOpeningFromGestureCallbackList =
base::RepeatingCallbackList<OnLinkOpeningFromGestureCallback::RunType>;
- using OnLinkOpeningFromGestureSubscription =
- std::unique_ptr<OnLinkOpeningFromGestureCallbackList::Subscription>;
// Listens to the "link opened from gesture" event. Callback will be called
// when a link is opened from user interaction in the same browser window, but
// before the tabstrip is actually modified. Useful for doing certain types
// of animations (e.g. "flying link" animation in tablet mode).
- OnLinkOpeningFromGestureSubscription AddOnLinkOpeningFromGestureCallback(
+ base::CallbackListSubscription AddOnLinkOpeningFromGestureCallback(
OnLinkOpeningFromGestureCallback callback);
// BrowserWindow:
@@ -929,7 +927,7 @@
std::unique_ptr<ImmersiveModeController> immersive_mode_controller_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&BrowserView::TouchModeChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h
index 310fb40..22514c2 100644
--- a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h
+++ b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h
@@ -58,7 +58,7 @@
ScopedObserver<views::Widget, views::WidgetObserver> widget_observer_{this};
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(base::BindRepeating(
&GlassBrowserCaptionButtonContainer::UpdateButtons,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.h b/chrome/browser/ui/views/frame/tab_strip_region_view.h
index 20c172c..a678241 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.h
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.h
@@ -84,7 +84,7 @@
views::ImageButton* leading_scroll_button_;
views::ImageButton* trailing_scroll_button_;
- const std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ const base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&TabStripRegionView::UpdateNewTabButtonBorder,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
index 4d7a8bb..2af33bcc 100644
--- a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
+++ b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
@@ -183,8 +183,7 @@
std::unique_ptr<TopControlsSlideTabObserver>>
observed_tabs_;
- std::unique_ptr<chromeos::AccessibilityStatusSubscription>
- accessibility_status_subscription_;
+ base::CallbackListSubscription accessibility_status_subscription_;
DISALLOW_COPY_AND_ASSIGN(TopControlsSlideControllerChromeOS);
};
diff --git a/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc b/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc
index a8d15fc5..dc4c0e1f 100644
--- a/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc
@@ -600,9 +600,7 @@
}
base::test::ScopedFeatureList feature_list_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(MediaDialogViewBrowserTest);
};
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
index 9fda3ab..708ef29d 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
@@ -451,9 +451,7 @@
OnSizeChanged();
}
-std::unique_ptr<
- MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::Subscription>
-MediaNotificationContainerImplView::
+base::CallbackListSubscription MediaNotificationContainerImplView::
RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::
CallbackType callback) {
@@ -461,8 +459,7 @@
std::move(callback));
}
-std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
-MediaNotificationContainerImplView::
+base::CallbackListSubscription MediaNotificationContainerImplView::
RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) {
return service_->RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
index 86d9aef..533a8ec 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
@@ -95,12 +95,10 @@
// Called when an audio device has been selected for output.
void OnAudioSinkChosen(const std::string& sink_id) override;
void OnDeviceSelectorViewSizeChanged() override;
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- RegisterAudioOutputDeviceDescriptionsCallback(
+ base::CallbackListSubscription RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::
CallbackType callback) override;
- std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+ base::CallbackListSubscription
RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) override;
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.cc b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.cc
index 8453aba..435b82cc 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.cc
@@ -166,7 +166,7 @@
}
MediaNotificationDeviceSelectorView::~MediaNotificationDeviceSelectorView() {
- audio_device_subscription_.release();
+ audio_device_subscription_ = {};
// If this metric has not been recorded during the lifetime of this view, it
// means that the device selector was never made available.
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h
index 54ca2bc..0ef611f 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h
@@ -107,11 +107,8 @@
ExpandDeviceSelectorButton* expand_button_ = nullptr;
views::View* device_entry_views_container_ = nullptr;
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- audio_device_subscription_;
- std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
- is_device_switching_enabled_subscription_;
+ base::CallbackListSubscription audio_device_subscription_;
+ base::CallbackListSubscription is_device_switching_enabled_subscription_;
std::unique_ptr<media_router::CastDialogController> cast_controller_;
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h
index 8434d85..0b94983 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h
@@ -11,12 +11,11 @@
public:
virtual void OnAudioSinkChosen(const std::string& sink_id) = 0;
virtual void OnDeviceSelectorViewSizeChanged() = 0;
- virtual std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
+ virtual base::CallbackListSubscription
RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::
CallbackType callback) = 0;
- virtual std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+ virtual base::CallbackListSubscription
RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) = 0;
};
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
index 150809b..e4a7d6f 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
@@ -63,15 +63,11 @@
void RunUICallback() { output_devices_callback_.Run(device_descriptions_); }
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- RegisterOutputDeviceDescriptionsCallback(
+ base::CallbackListSubscription RegisterOutputDeviceDescriptionsCallback(
GetOutputDevicesCallback cb) override {
output_devices_callback_ = std::move(cb);
RunUICallback();
- return std::unique_ptr<MockMediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>(
- nullptr);
+ return base::CallbackListSubscription();
}
MOCK_METHOD(void,
@@ -98,9 +94,7 @@
(override));
MOCK_METHOD(void, OnDeviceSelectorViewSizeChanged, (), (override));
- std::unique_ptr<MediaNotificationDeviceProvider::
- GetOutputDevicesCallbackList::Subscription>
- RegisterAudioOutputDeviceDescriptionsCallback(
+ base::CallbackListSubscription RegisterAudioOutputDeviceDescriptionsCallback(
MediaNotificationDeviceProvider::GetOutputDevicesCallbackList::
CallbackType callback) override {
return provider_->RegisterOutputDeviceDescriptionsCallback(
@@ -109,12 +103,12 @@
MockMediaNotificationDeviceProvider* GetProvider() { return provider_.get(); }
- std::unique_ptr<base::RepeatingCallbackList<void(bool)>::Subscription>
+ base::CallbackListSubscription
RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) override {
callback.Run(supports_switching);
supports_switching_callback_ = std::move(callback);
- return nullptr;
+ return base::CallbackListSubscription();
}
void RunSupportsDeviceSwitchingCallback() {
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
index fa999fca..02a3dd2c 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -264,7 +264,7 @@
// virtual child of this view.
views::AXVirtualView* alert_virtual_view_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&IconLabelBubbleView::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 8471c31..4e9dfc8 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -417,7 +417,7 @@
bool is_initialized_ = false;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&LocationBarView::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
index 6be73b6..01d132f 100644
--- a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
+++ b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
@@ -52,7 +52,7 @@
const UIMediaSink sink_;
base::Optional<base::string16> saved_status_text_;
- views::PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&CastDialogSinkButton::OnEnabledChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/media_router/presentation_receiver_window_view_browsertest.cc b/chrome/browser/ui/views/media_router/presentation_receiver_window_view_browsertest.cc
index e09036b5..61e3532 100644
--- a/chrome/browser/ui/views/media_router/presentation_receiver_window_view_browsertest.cc
+++ b/chrome/browser/ui/views/media_router/presentation_receiver_window_view_browsertest.cc
@@ -148,7 +148,7 @@
}
PresentationReceiverWindowView* const receiver_view_;
- views::PropertyChangedSubscription subscription_;
+ base::CallbackListSubscription subscription_;
const AwaitType await_type_;
base::OnceClosure fullscreen_callback_;
diff --git a/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc b/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc
index fc2e99a..69918f4 100644
--- a/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc
+++ b/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc
@@ -317,7 +317,7 @@
safe_browsing::SafeBrowsingService* sb_service =
g_browser_process->safe_browsing_service();
- safe_browsing::NativeFileSystemWriteRequestSubscription subscription =
+ base::CallbackListSubscription subscription =
sb_service->download_protection_service()
->RegisterNativeFileSystemWriteRequestCallback(
base::BindLambdaForTesting(
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
index 4738618..4b39cee 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
@@ -475,7 +475,7 @@
~ProfileMenuClickTestBase() override = default;
void SetUpInProcessBrowserTestFixture() override {
- test_signin_client_factory_ =
+ test_signin_client_subscription_ =
secondary_account_helper::SetUpSigninClient(&test_url_loader_factory_);
}
@@ -511,8 +511,7 @@
return profile_menu_view()->GetFocusManager()->GetFocusedView();
}
- secondary_account_helper::ScopedSigninClientFactory
- test_signin_client_factory_;
+ base::CallbackListSubscription test_signin_client_subscription_;
base::HistogramTester histogram_tester_;
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
index f1c72ae..c22da81 100644
--- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
@@ -300,9 +300,7 @@
}
private:
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
base::test::ScopedFeatureList feature_list_;
// The sync service and waits for policies to load before starting for
diff --git a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view.cc b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view.cc
index e320e8c..961a742 100644
--- a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view.cc
+++ b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view.cc
@@ -231,8 +231,8 @@
main_view->set_selected_parent_permission_email_address(parent_email);
}
- views::PropertyChangedSubscription parent_0_subscription_;
- views::PropertyChangedSubscription parent_1_subscription_;
+ base::CallbackListSubscription parent_0_subscription_;
+ base::CallbackListSubscription parent_1_subscription_;
// The credential input field.
views::Textfield* credential_input_field_ = nullptr;
diff --git a/chrome/browser/ui/views/sync/inline_login_ui_browsertest.cc b/chrome/browser/ui/views/sync/inline_login_ui_browsertest.cc
index 965c794..ef9a76e 100644
--- a/chrome/browser/ui/views/sync/inline_login_ui_browsertest.cc
+++ b/chrome/browser/ui/views/sync/inline_login_ui_browsertest.cc
@@ -515,9 +515,7 @@
private:
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_profile_adaptor_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
Profile* profile_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(InlineLoginHelperBrowserTest);
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
index fefa4089..6a13ef8 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.h
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -758,7 +758,7 @@
SkColor separator_color_ = gfx::kPlaceholderColor;
- const std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ const base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&TabStrip::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/toolbar/app_menu.cc b/chrome/browser/ui/views/toolbar/app_menu.cc
index a0f5557..9638ae8e 100644
--- a/chrome/browser/ui/views/toolbar/app_menu.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu.cc
@@ -628,8 +628,7 @@
return zoom_label_max_width_;
}
- std::unique_ptr<content::HostZoomMap::Subscription>
- browser_zoom_subscription_;
+ base::CallbackListSubscription browser_zoom_subscription_;
// Button for incrementing the zoom.
LabelButton* increment_button_;
diff --git a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
index c7b78327..7228182 100644
--- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
+++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
@@ -91,7 +91,7 @@
base::Optional<FeaturePromoController::PromoHandle> reopen_tab_promo_handle_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&BrowserAppMenuButton::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.h b/chrome/browser/ui/views/toolbar/toolbar_button.h
index 044fbb1..313334e 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.h
@@ -280,7 +280,7 @@
base::Optional<SkColor> last_border_color_;
gfx::Insets last_paint_insets_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&ToolbarButton::UpdateIcon,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
index dc834b3..359708b 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
@@ -110,7 +110,7 @@
// Tracks when the widget is restored and resets the layout.
std::unique_ptr<WidgetRestoreObserver> restore_observer_;
- std::list<views::PropertyChangedSubscription> subscriptions_;
+ std::list<base::CallbackListSubscription> subscriptions_;
base::ObserverList<Observer> observers_;
};
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h
index 78c615c..1a00af8 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -285,7 +285,7 @@
// The display mode used when laying out the toolbar.
const DisplayMode display_mode_;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
base::BindRepeating(&ToolbarView::OnTouchUiChanged,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
index ef598ba..d9ea0a1 100644
--- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
+++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
@@ -487,8 +487,7 @@
TabStripModel* const tab_strip_model_;
BrowserView* const browser_view_;
- BrowserView::OnLinkOpeningFromGestureSubscription
- link_opened_from_gesture_subscription_;
+ base::CallbackListSubscription link_opened_from_gesture_subscription_;
};
WebUITabCounterButton::WebUITabCounterButton(PressedCallback pressed_callback,
diff --git a/chrome/browser/ui/views/user_education/feature_promo_dialog_browsertest.cc b/chrome/browser/ui/views/user_education/feature_promo_dialog_browsertest.cc
index 8f1ac27..a7965b6 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_dialog_browsertest.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_dialog_browsertest.cc
@@ -91,11 +91,10 @@
return mock_tracker;
}
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- subscription_{BrowserContextDependencyManager::GetInstance()
- ->RegisterCreateServicesCallbackForTesting(
- base::BindRepeating(RegisterMockTracker))};
+ base::CallbackListSubscription subscription_{
+ BrowserContextDependencyManager::GetInstance()
+ ->RegisterCreateServicesCallbackForTesting(
+ base::BindRepeating(RegisterMockTracker))};
};
// Adding new tests for your promo
diff --git a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
index 45c0f91..ada418440 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
@@ -172,9 +172,7 @@
base::test::ScopedFeatureList scoped_feature_list_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
};
IN_PROC_BROWSER_TEST_F(FeaturePromoSnoozeInteractiveTest,
diff --git a/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc b/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
index d20b347..afb3ab6 100644
--- a/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
+++ b/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
@@ -236,12 +236,9 @@
// Immediately re-download and apply XML rules.
void HandleRefreshXml(const base::ListValue* args);
- std::unique_ptr<browser_switcher::BrowserSwitcherPrefs::CallbackSubscription>
- prefs_subscription_;
+ base::CallbackListSubscription prefs_subscription_;
- std::unique_ptr<
- browser_switcher::BrowserSwitcherService::CallbackSubscription>
- service_subscription_;
+ base::CallbackListSubscription service_subscription_;
base::WeakPtrFactory<BrowserSwitchHandler> weak_ptr_factory_{this};
@@ -294,8 +291,8 @@
}
void BrowserSwitchHandler::OnJavascriptDisallowed() {
- prefs_subscription_.reset();
- service_subscription_.reset();
+ prefs_subscription_ = {};
+ service_subscription_ = {};
}
void BrowserSwitchHandler::OnAllRulesetsParsed(
diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
index aac46d69..2b0d071 100644
--- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
@@ -59,7 +59,7 @@
void UpdateScreenHandler::OnAccessibilityStatusChanged(
const AccessibilityStatusEventDetails& details) {
if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) {
- accessibility_subscription_.reset();
+ accessibility_subscription_ = {};
return;
}
diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
index a0ccdd0..6d102cd 100644
--- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
@@ -102,7 +102,7 @@
UpdateScreen* screen_ = nullptr;
- std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
// If true, Initialize() will call Show().
bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
index 6808354..64d7d57 100644
--- a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
@@ -290,7 +290,7 @@
void WelcomeScreenHandler::OnAccessibilityStatusChanged(
const AccessibilityStatusEventDetails& details) {
if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN)
- accessibility_subscription_.reset();
+ accessibility_subscription_ = {};
else
UpdateA11yState();
}
diff --git a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
index 38c505d0..20e1aba 100644
--- a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
@@ -110,7 +110,7 @@
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
- std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
DISALLOW_COPY_AND_ASSIGN(WelcomeScreenHandler);
};
diff --git a/chrome/browser/ui/webui/history/foreign_session_handler.h b/chrome/browser/ui/webui/history/foreign_session_handler.h
index 7e249a6..0766177 100644
--- a/chrome/browser/ui/webui/history/foreign_session_handler.h
+++ b/chrome/browser/ui/webui/history/foreign_session_handler.h
@@ -101,8 +101,7 @@
base::Value initial_session_list_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- foreign_session_updated_subscription_;
+ base::CallbackListSubscription foreign_session_updated_subscription_;
DISALLOW_COPY_AND_ASSIGN(ForeignSessionHandler);
};
diff --git a/chrome/browser/ui/webui/settings/accessibility_main_handler.cc b/chrome/browser/ui/webui/settings/accessibility_main_handler.cc
index 4a5a81f..20af59f6 100644
--- a/chrome/browser/ui/webui/settings/accessibility_main_handler.cc
+++ b/chrome/browser/ui/webui/settings/accessibility_main_handler.cc
@@ -48,7 +48,7 @@
void AccessibilityMainHandler::OnJavascriptDisallowed() {
#if defined(OS_CHROMEOS)
- accessibility_subscription_.reset();
+ accessibility_subscription_ = {};
#endif // defined(OS_CHROMEOS)
}
diff --git a/chrome/browser/ui/webui/settings/accessibility_main_handler.h b/chrome/browser/ui/webui/settings/accessibility_main_handler.h
index ebc1f51b..471690af 100644
--- a/chrome/browser/ui/webui/settings/accessibility_main_handler.h
+++ b/chrome/browser/ui/webui/settings/accessibility_main_handler.h
@@ -44,8 +44,7 @@
void OnAccessibilityStatusChanged(
const chromeos::AccessibilityStatusEventDetails& details);
- std::unique_ptr<chromeos::AccessibilityStatusSubscription>
- accessibility_subscription_;
+ base::CallbackListSubscription accessibility_subscription_;
#endif // defined(OS_CHROMEOS)
};
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
index 8dc3fcd..157ccab 100644
--- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -227,7 +227,7 @@
crostini::CrostiniPortForwarder::GetForProfile(profile_)->RemoveObserver(
this);
- adb_sideloading_device_policy_subscription_.reset();
+ adb_sideloading_device_policy_subscription_ = {};
pref_change_registrar_.RemoveAll();
}
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
index 3839b2f..ea70a39 100644
--- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
@@ -156,8 +156,7 @@
void OnCanChangeArcAdbSideloading(bool can_change_arc_adb_sideloading);
Profile* profile_;
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- adb_sideloading_device_policy_subscription_;
+ base::CallbackListSubscription adb_sideloading_device_policy_subscription_;
PrefChangeRegistrar pref_change_registrar_;
// weak_ptr_factory_ should always be last member.
base::WeakPtrFactory<CrostiniHandler> weak_ptr_factory_{this};
diff --git a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
index 203ea6a2..647025a 100644
--- a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
@@ -110,7 +110,7 @@
void DateTimeHandler::OnJavascriptDisallowed() {
scoped_observer_.RemoveAll();
- system_timezone_policy_subscription_.reset();
+ system_timezone_policy_subscription_ = {};
local_state_pref_change_registrar_.RemoveAll();
}
diff --git a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
index 102fb30e..e301d09 100644
--- a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
@@ -59,8 +59,7 @@
// setting according to policy.
void NotifyTimezoneAutomaticDetectionPolicy();
- std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
- system_timezone_policy_subscription_;
+ base::CallbackListSubscription system_timezone_policy_subscription_;
// Used to listen to changes to the system time zone detection policy.
PrefChangeRegistrar local_state_pref_change_registrar_;
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 9a28e12c..d08b33c 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -540,7 +540,7 @@
void SiteSettingsHandler::OnJavascriptDisallowed() {
observer_.RemoveAll();
chooser_observer_.RemoveAll();
- host_zoom_map_subscription_.reset();
+ host_zoom_map_subscription_ = {};
pref_change_registrar_->Remove(prefs::kBlockAutoplayEnabled);
pref_change_registrar_->Remove(prefs::kCookieControlsMode);
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.h b/chrome/browser/ui/webui/settings/site_settings_handler.h
index 54c9689..7e5f6da4 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.h
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -87,7 +87,6 @@
ContentSettingsType guard_content_settings_type,
ContentSettingsType data_content_settings_type) override;
- // content::HostZoomMap subscription.
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
private:
@@ -265,8 +264,7 @@
ScopedObserver<Profile, ProfileObserver> observed_profiles_{this};
// Keeps track of events related to zooming.
- std::unique_ptr<content::HostZoomMap::Subscription>
- host_zoom_map_subscription_;
+ base::CallbackListSubscription host_zoom_map_subscription_;
// The host for which to fetch usage.
std::string usage_host_;
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
index d909259b..585334b 100644
--- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
+++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
@@ -255,8 +255,7 @@
std::unique_ptr<SyncStartupTracker> sync_startup_tracker_;
std::unique_ptr<DiceSignedInProfileCreator> dice_signed_in_profile_creator_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_subscription_;
+ base::CallbackListSubscription shutdown_subscription_;
base::WeakPtrFactory<DiceTurnSyncOnHelper> weak_pointer_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DiceTurnSyncOnHelper);
diff --git a/chrome/browser/ui/webui/supervised_user_internals_message_handler.h b/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
index cb4f576..68b2af8 100644
--- a/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
+++ b/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
@@ -57,9 +57,7 @@
supervised_user_error_page::FilteringBehaviorReason reason,
bool uncertain) override;
- std::unique_ptr<
- base::CallbackList<void(const base::DictionaryValue*)>::Subscription>
- user_settings_subscription_;
+ base::CallbackListSubscription user_settings_subscription_;
ScopedObserver<SupervisedUserURLFilter, SupervisedUserURLFilter::Observer>
scoped_observer_{this};
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.cc b/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.cc
index 8047dcd..a35c0c2 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.cc
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.cc
@@ -29,8 +29,8 @@
void ChromeZoomLevelOTRDelegate::OnZoomLevelChanged(
const content::HostZoomMap::ZoomLevelChange& change) {
// If there's a manager to aggregate ZoomLevelChanged events, pass this event
- // along. Since we already hold a subscription to our associated HostZoomMap,
- // we don't need to create a separate subscription for this.
+ // along. Since we already hold a subscription from our associated
+ // HostZoomMap, we don't need to create a separate subscription for this.
if (zoom_event_manager_)
zoom_event_manager_->OnZoomLevelChanged(change);
}
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h b/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h
index 5ea6ff8..5368c267 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h
@@ -35,7 +35,7 @@
base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager_;
content::HostZoomMap* host_zoom_map_;
- std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
+ base::CallbackListSubscription zoom_subscription_;
DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelOTRDelegate);
};
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
index c0d72e1..4ca6c5a 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
@@ -104,7 +104,7 @@
return default_zoom_level;
}
-std::unique_ptr<ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
+base::CallbackListSubscription
ChromeZoomLevelPrefs::RegisterDefaultZoomLevelCallback(
const base::Closure& callback) {
return default_zoom_changed_callbacks_.Add(callback);
@@ -233,8 +233,8 @@
if (host_zoom_dictionaries->GetDictionary(partition_key_,
&host_zoom_dictionary)) {
// Since we're calling this before setting up zoom_subscription_ below we
- // don't need to worry that host_zoom_dictionary is indirectly affected
- // by calls to HostZoomMap::SetZoomLevelForHost().
+ // don't need to worry that host_zoom_dictionary is indirectly affected by
+ // calls to HostZoomMap::SetZoomLevelForHost().
ExtractPerHostZoomLevels(host_zoom_dictionary,
true /* sanitize_partition_host_zoom_levels */);
}
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h
index 805613930..c901671 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h
@@ -34,9 +34,6 @@
// OnZoomLevelChanged.
class ChromeZoomLevelPrefs : public content::ZoomLevelDelegate {
public:
- typedef base::CallbackList<void(void)>::Subscription
- DefaultZoomLevelSubscription;
-
// Initialize the pref_service and the partition_key via the constructor,
// as these concepts won't be available in the content base class
// ZoomLevelDelegate, which will define the InitHostZoomMap interface.
@@ -53,8 +50,8 @@
void SetDefaultZoomLevelPref(double level);
double GetDefaultZoomLevelPref() const;
- std::unique_ptr<DefaultZoomLevelSubscription>
- RegisterDefaultZoomLevelCallback(const base::Closure& callback);
+ base::CallbackListSubscription RegisterDefaultZoomLevelCallback(
+ const base::Closure& callback);
void ExtractPerHostZoomLevels(
const base::DictionaryValue* host_zoom_dictionary,
@@ -72,7 +69,7 @@
PrefService* pref_service_;
base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager_;
content::HostZoomMap* host_zoom_map_;
- std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
+ base::CallbackListSubscription zoom_subscription_;
std::string partition_key_;
base::CallbackList<void(void)> default_zoom_changed_callbacks_;
diff --git a/chrome/browser/web_applications/test/test_web_app_provider.h b/chrome/browser/web_applications/test/test_web_app_provider.h
index 6531ed39..a0de3876 100644
--- a/chrome/browser/web_applications/test/test_web_app_provider.h
+++ b/chrome/browser/web_applications/test/test_web_app_provider.h
@@ -99,9 +99,7 @@
CreateWebAppProviderCallback callback_;
- std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
- create_services_subscription_;
+ base::CallbackListSubscription create_services_subscription_;
};
} // namespace web_app
diff --git a/chrome/test/base/search_test_utils.cc b/chrome/test/base/search_test_utils.cc
index dc72a2c8..77ac4977 100644
--- a/chrome/test/base/search_test_utils.cc
+++ b/chrome/test/base/search_test_utils.cc
@@ -17,7 +17,7 @@
return;
scoped_refptr<content::MessageLoopRunner> message_loop_runner =
new content::MessageLoopRunner;
- std::unique_ptr<TemplateURLService::Subscription> subscription =
+ base::CallbackListSubscription subscription =
service->RegisterOnLoadedCallback(
base::BindLambdaForTesting([&]() { message_loop_runner->Quit(); }));
service->Load();
diff --git a/chromecast/browser/cast_extension_url_loader_factory.h b/chromecast/browser/cast_extension_url_loader_factory.h
index f39c9ef..5669514 100644
--- a/chromecast/browser/cast_extension_url_loader_factory.h
+++ b/chromecast/browser/cast_extension_url_loader_factory.h
@@ -94,8 +94,7 @@
mojo::Remote<network::mojom::URLLoaderFactory> extension_factory_;
scoped_refptr<network::SharedURLLoaderFactory> network_factory_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- browser_context_shutdown_subscription_;
+ base::CallbackListSubscription browser_context_shutdown_subscription_;
DISALLOW_COPY_AND_ASSIGN(CastExtensionURLLoaderFactory);
};
diff --git a/chromecast/external_mojo/external_service_support/external_connector.h b/chromecast/external_mojo/external_service_support/external_connector.h
index ce0fc8ad..aaf93020 100644
--- a/chromecast/external_mojo/external_service_support/external_connector.h
+++ b/chromecast/external_mojo/external_service_support/external_connector.h
@@ -39,14 +39,12 @@
virtual ~ExternalConnector() = default;
// Adds a callback that will be called if this class loses its connection to
- // the Mojo broker. The calling class must retain the returned Subscription
- // until it intends to unregister.
- // By the time |callback| is executed, a new attempt at connecting will be
- // started, and this object is valid. Note that some prior messages may be
- // lost.
- virtual std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddConnectionErrorCallback(base::RepeatingClosure callback)
- WARN_UNUSED_RESULT = 0;
+ // the Mojo broker. The calling class must retain the returned subscription
+ // until it intends to unregister. By the time |callback| is executed, a new
+ // attempt at connecting will be started, and this object is valid. Note that
+ // some prior messages may be lost.
+ virtual base::CallbackListSubscription AddConnectionErrorCallback(
+ base::RepeatingClosure callback) WARN_UNUSED_RESULT = 0;
// Registers a service that other Mojo processes/services can bind to. Others
// can call BindInterface(|service_name|, interface_name) to bind to this
diff --git a/chromecast/external_mojo/external_service_support/external_connector_impl.cc b/chromecast/external_mojo/external_service_support/external_connector_impl.cc
index 51f1354..ad5889ac 100644
--- a/chromecast/external_mojo/external_service_support/external_connector_impl.cc
+++ b/chromecast/external_mojo/external_service_support/external_connector_impl.cc
@@ -162,7 +162,7 @@
ExternalConnectorImpl::~ExternalConnectorImpl() = default;
-std::unique_ptr<base::CallbackList<void()>::Subscription>
+base::CallbackListSubscription
ExternalConnectorImpl::AddConnectionErrorCallback(
base::RepeatingClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chromecast/external_mojo/external_service_support/external_connector_impl.h b/chromecast/external_mojo/external_service_support/external_connector_impl.h
index 585374b..546ba4f6 100644
--- a/chromecast/external_mojo/external_service_support/external_connector_impl.h
+++ b/chromecast/external_mojo/external_service_support/external_connector_impl.h
@@ -35,8 +35,8 @@
~ExternalConnectorImpl() override;
// ExternalConnector implementation:
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddConnectionErrorCallback(base::RepeatingClosure callback) override;
+ base::CallbackListSubscription AddConnectionErrorCallback(
+ base::RepeatingClosure callback) override;
void RegisterService(const std::string& service_name,
ExternalService* service) override;
void RegisterService(
diff --git a/components/autofill/ios/form_util/form_activity_tab_helper.h b/components/autofill/ios/form_util/form_activity_tab_helper.h
index 976a4634..72461af 100644
--- a/components/autofill/ios/form_util/form_activity_tab_helper.h
+++ b/components/autofill/ios/form_util/form_activity_tab_helper.h
@@ -69,7 +69,7 @@
base::ObserverList<FormActivityObserver>::Unchecked observers_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
WEB_STATE_USER_DATA_KEY_DECL();
diff --git a/components/captive_portal/content/captive_portal_service.h b/components/captive_portal/content/captive_portal_service.h
index deeaaa2..6890c3d 100644
--- a/components/captive_portal/content/captive_portal_service.h
+++ b/components/captive_portal/content/captive_portal_service.h
@@ -61,8 +61,6 @@
GURL landing_url;
};
- using Subscription = base::CallbackList<void(const Results&)>::Subscription;
-
CaptivePortalService(
content::BrowserContext* browser_context,
PrefService* pref_service,
@@ -75,7 +73,7 @@
// Always sends the result notification asynchronously.
void DetectCaptivePortal(CaptivePortalProbeReason probe_reason);
- std::unique_ptr<Subscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const base::RepeatingCallback<void(const Results&)>& cb) {
return callback_list_.Add(cb);
}
diff --git a/components/captive_portal/content/captive_portal_service_unittest.cc b/components/captive_portal/content/captive_portal_service_unittest.cc
index 30bf310..c59aad78 100644
--- a/components/captive_portal/content/captive_portal_service_unittest.cc
+++ b/components/captive_portal/content/captive_portal_service_unittest.cc
@@ -56,7 +56,7 @@
CaptivePortalService* captive_portal_service_;
- std::unique_ptr<CaptivePortalService::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(CaptivePortalObserver);
};
diff --git a/components/captive_portal/content/captive_portal_tab_helper.h b/components/captive_portal/content/captive_portal_tab_helper.h
index 2c1fcf3..ebe3ed4 100644
--- a/components/captive_portal/content/captive_portal_tab_helper.h
+++ b/components/captive_portal/content/captive_portal_tab_helper.h
@@ -120,7 +120,7 @@
// portal resolution.
bool is_captive_portal_window_;
- std::unique_ptr<CaptivePortalService::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
WEB_CONTENTS_USER_DATA_KEY_DECL();
diff --git a/components/guest_view/browser/guest_view_message_filter.cc b/components/guest_view/browser/guest_view_message_filter.cc
index ab318565..464577d8 100644
--- a/components/guest_view/browser/guest_view_message_filter.cc
+++ b/components/guest_view/browser/guest_view_message_filter.cc
@@ -74,7 +74,7 @@
void GuestViewMessageFilter::OnBrowserContextShutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
browser_context_ = nullptr;
- browser_context_shutdown_subscription_.reset();
+ browser_context_shutdown_subscription_ = {};
}
GuestViewManager* GuestViewMessageFilter::GetOrCreateGuestViewManager() {
diff --git a/components/guest_view/browser/guest_view_message_filter.h b/components/guest_view/browser/guest_view_message_filter.h
index 05ba074..46392a4 100644
--- a/components/guest_view/browser/guest_view_message_filter.h
+++ b/components/guest_view/browser/guest_view_message_filter.h
@@ -80,8 +80,7 @@
void OnBrowserContextShutdown();
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- browser_context_shutdown_subscription_;
+ base::CallbackListSubscription browser_context_shutdown_subscription_;
DISALLOW_COPY_AND_ASSIGN(GuestViewMessageFilter);
};
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc
index 9d365a8..dda5e852 100644
--- a/components/history/core/browser/history_service.cc
+++ b/components/history/core/browser/history_service.cc
@@ -1248,8 +1248,7 @@
observer.OnKeywordSearchTermDeleted(this, url_id);
}
-std::unique_ptr<HistoryService::FaviconsChangedCallbackList::Subscription>
-HistoryService::AddFaviconsChangedCallback(
+base::CallbackListSubscription HistoryService::AddFaviconsChangedCallback(
const HistoryService::FaviconsChangedCallback& callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return favicons_changed_callback_list_.Add(callback);
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h
index 35496860..08beb26 100644
--- a/components/history/core/browser/history_service.h
+++ b/components/history/core/browser/history_service.h
@@ -484,11 +484,10 @@
using FaviconsChangedCallback = FaviconsChangedCallbackList::CallbackType;
// 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.
- std::unique_ptr<FaviconsChangedCallbackList::Subscription>
- AddFaviconsChangedCallback(const FaviconsChangedCallback& callback)
- WARN_UNUSED_RESULT;
+ base::CallbackListSubscription AddFaviconsChangedCallback(
+ const FaviconsChangedCallback& callback) WARN_UNUSED_RESULT;
// Testing -------------------------------------------------------------------
diff --git a/components/keyed_service/content/browser_context_dependency_manager.cc b/components/keyed_service/content/browser_context_dependency_manager.cc
index 9d37e42..1736805 100644
--- a/components/keyed_service/content/browser_context_dependency_manager.cc
+++ b/components/keyed_service/content/browser_context_dependency_manager.cc
@@ -51,8 +51,7 @@
DependencyManager::DestroyContextServices(context);
}
-std::unique_ptr<
- BrowserContextDependencyManager::CreateServicesCallbackList::Subscription>
+base::CallbackListSubscription
BrowserContextDependencyManager::RegisterCreateServicesCallbackForTesting(
const CreateServicesCallback& callback) {
return create_services_callbacks_.Add(callback);
diff --git a/components/keyed_service/content/browser_context_dependency_manager.h b/components/keyed_service/content/browser_context_dependency_manager.h
index 2f2bec56..4628cc6 100644
--- a/components/keyed_service/content/browser_context_dependency_manager.h
+++ b/components/keyed_service/content/browser_context_dependency_manager.h
@@ -66,8 +66,7 @@
// CreateBrowserContextServices() or CreateBrowserContextServicesForTest().
// This can be useful in browser tests which wish to substitute test or mock
// builders for the keyed services.
- std::unique_ptr<CreateServicesCallbackList::Subscription>
- RegisterCreateServicesCallbackForTesting(
+ base::CallbackListSubscription RegisterCreateServicesCallbackForTesting(
const CreateServicesCallback& callback) WARN_UNUSED_RESULT;
// Runtime assertion called as a part of GetServiceForBrowserContext() to
diff --git a/components/keyed_service/core/keyed_service_shutdown_notifier.cc b/components/keyed_service/core/keyed_service_shutdown_notifier.cc
index 2210db5..65a8116 100644
--- a/components/keyed_service/core/keyed_service_shutdown_notifier.cc
+++ b/components/keyed_service/core/keyed_service_shutdown_notifier.cc
@@ -10,8 +10,7 @@
KeyedServiceShutdownNotifier::~KeyedServiceShutdownNotifier() {
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
-KeyedServiceShutdownNotifier::Subscribe(
+base::CallbackListSubscription KeyedServiceShutdownNotifier::Subscribe(
const base::RepeatingClosure& callback) {
return callback_list_.Add(callback);
}
diff --git a/components/keyed_service/core/keyed_service_shutdown_notifier.h b/components/keyed_service/core/keyed_service_shutdown_notifier.h
index 7418770..9ec0e73 100644
--- a/components/keyed_service/core/keyed_service_shutdown_notifier.h
+++ b/components/keyed_service/core/keyed_service_shutdown_notifier.h
@@ -20,15 +20,13 @@
// dependencies and notify its observers.
class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService {
public:
- using Subscription = base::CallbackList<void()>::Subscription;
-
KeyedServiceShutdownNotifier();
~KeyedServiceShutdownNotifier() override;
// Subscribe for a notification when the keyed services this object depends on
- // (as defined by its factory) are shut down. The subscription object can be
+ // (as defined by its factory) are shut down. The subscription can be
// destroyed to unsubscribe.
- std::unique_ptr<Subscription> Subscribe(
+ base::CallbackListSubscription Subscribe(
const base::RepeatingClosure& callback);
private:
diff --git a/components/media_router/browser/android/media_router_android_unittest.cc b/components/media_router/browser/android/media_router_android_unittest.cc
index bd62843..d6f6fcf 100644
--- a/components/media_router/browser/android/media_router_android_unittest.cc
+++ b/components/media_router/browser/android/media_router_android_unittest.cc
@@ -91,7 +91,7 @@
EXPECT_NE(nullptr, router_->FindRouteBySource("source"));
- std::unique_ptr<PresentationConnectionStateSubscription> subscription =
+ base::CallbackListSubscription subscription =
router_->AddPresentationConnectionStateChangedCallback("route",
callback.Get());
router_->DetachRoute("route");
@@ -139,7 +139,7 @@
EXPECT_NE(nullptr, router_->FindRouteBySource("source"));
- std::unique_ptr<PresentationConnectionStateSubscription> subscription =
+ base::CallbackListSubscription subscription =
router_->AddPresentationConnectionStateChangedCallback("route",
callback.Get());
router_->OnRouteClosed("route", base::nullopt);
@@ -167,7 +167,7 @@
EXPECT_NE(nullptr, router_->FindRouteBySource("source"));
- std::unique_ptr<PresentationConnectionStateSubscription> subscription =
+ base::CallbackListSubscription subscription =
router_->AddPresentationConnectionStateChangedCallback("route",
callback.Get());
router_->OnRouteClosed("route", "Some failure");
diff --git a/components/media_router/browser/media_router.h b/components/media_router/browser/media_router.h
index 3891a7b..241f978e 100644
--- a/components/media_router/browser/media_router.h
+++ b/components/media_router/browser/media_router.h
@@ -58,12 +58,6 @@
base::OnceCallback<void(mojom::RoutePresentationConnectionPtr connection,
const RouteRequestResult& result)>;
-// Subscription object returned by calling
-// |AddPresentationConnectionStateChangedCallback|. See the method comments for
-// details.
-using PresentationConnectionStateSubscription = base::CallbackList<void(
- const content::PresentationConnectionStateChangeInfo&)>::Subscription;
-
// An interface for handling resources related to media routing.
// Responsible for registering observers for receiving sink availability
// updates, handling route requests/responses, and operating on routes (e.g.
@@ -161,10 +155,10 @@
virtual void OnUserGesture() = 0;
// Adds |callback| to listen for state changes for presentation connected to
- // |route_id|. The returned Subscription object is owned by the caller.
- // |callback| will be invoked whenever there are state changes, until the
- // caller destroys the Subscription object.
- virtual std::unique_ptr<PresentationConnectionStateSubscription>
+ // |route_id|. The returned subscription is owned by the caller. |callback|
+ // will be invoked whenever there are state changes, until the caller destroys
+ // the subscription.
+ virtual base::CallbackListSubscription
AddPresentationConnectionStateChangedCallback(
const MediaRoute::Id& route_id,
const content::PresentationConnectionStateChangedCallback& callback) = 0;
diff --git a/components/media_router/browser/media_router_base.cc b/components/media_router/browser/media_router_base.cc
index 00991de..228afa8 100644
--- a/components/media_router/browser/media_router_base.cc
+++ b/components/media_router/browser/media_router_base.cc
@@ -51,7 +51,7 @@
CHECK(!internal_routes_observer_);
}
-std::unique_ptr<PresentationConnectionStateSubscription>
+base::CallbackListSubscription
MediaRouterBase::AddPresentationConnectionStateChangedCallback(
const MediaRoute::Id& route_id,
const content::PresentationConnectionStateChangedCallback& callback) {
diff --git a/components/media_router/browser/media_router_base.h b/components/media_router/browser/media_router_base.h
index dfdf4c4..ef694e2 100644
--- a/components/media_router/browser/media_router_base.h
+++ b/components/media_router/browser/media_router_base.h
@@ -35,8 +35,7 @@
void Initialize();
// MediaRouter implementation.
- std::unique_ptr<PresentationConnectionStateSubscription>
- AddPresentationConnectionStateChangedCallback(
+ base::CallbackListSubscription AddPresentationConnectionStateChangedCallback(
const MediaRoute::Id& route_id,
const content::PresentationConnectionStateChangedCallback& callback)
override;
diff --git a/components/media_router/browser/media_router_base_unittest.cc b/components/media_router/browser/media_router_base_unittest.cc
index b0ffdca9..a6c860d38 100644
--- a/components/media_router/browser/media_router_base_unittest.cc
+++ b/components/media_router/browser/media_router_base_unittest.cc
@@ -25,8 +25,7 @@
MockMediaRouterBase() {}
~MockMediaRouterBase() override {}
- std::unique_ptr<PresentationConnectionStateSubscription>
- AddPresentationConnectionStateChangedCallback(
+ base::CallbackListSubscription AddPresentationConnectionStateChangedCallback(
const MediaRoute::Id& route_id,
const content::PresentationConnectionStateChangedCallback& callback)
override {
@@ -74,10 +73,10 @@
callback1;
base::MockCallback<content::PresentationConnectionStateChangedCallback>
callback2;
- std::unique_ptr<PresentationConnectionStateSubscription> subscription1 =
+ base::CallbackListSubscription subscription1 =
router_.AddPresentationConnectionStateChangedCallback(route_id1,
callback1.Get());
- std::unique_ptr<PresentationConnectionStateSubscription> subscription2 =
+ base::CallbackListSubscription subscription2 =
router_.AddPresentationConnectionStateChangedCallback(route_id2,
callback2.Get());
@@ -105,7 +104,7 @@
// After removing a subscription, the corresponding callback should no longer
// be called.
- subscription1.reset();
+ subscription1 = {};
router_.NotifyPresentationConnectionStateChange(
route_id1, PresentationConnectionState::TERMINATED);
@@ -113,7 +112,7 @@
router_.NotifyPresentationConnectionStateChange(
route_id2, PresentationConnectionState::TERMINATED);
- subscription2.reset();
+ subscription2 = {};
router_.NotifyPresentationConnectionStateChange(
route_id2, PresentationConnectionState::TERMINATED);
}
diff --git a/components/media_router/browser/presentation/presentation_service_delegate_impl.cc b/components/media_router/browser/presentation/presentation_service_delegate_impl.cc
index 293e007..9eeb5b2 100644
--- a/components/media_router/browser/presentation/presentation_service_delegate_impl.cc
+++ b/components/media_router/browser/presentation/presentation_service_delegate_impl.cc
@@ -124,8 +124,7 @@
base::small_map<
std::map<std::string, std::unique_ptr<PresentationMediaSinksObserver>>>
url_to_sinks_observer_;
- std::unordered_map<MediaRoute::Id,
- std::unique_ptr<PresentationConnectionStateSubscription>>
+ std::unordered_map<MediaRoute::Id, base::CallbackListSubscription>
connection_state_subscriptions_;
std::unordered_map<MediaRoute::Id,
std::unique_ptr<BrowserPresentationConnectionProxy>>
diff --git a/components/media_router/browser/test/mock_media_router.h b/components/media_router/browser/test/mock_media_router.h
index 5d33cccf..a87cb6f 100644
--- a/components/media_router/browser/test/mock_media_router.h
+++ b/components/media_router/browser/test/mock_media_router.h
@@ -107,8 +107,7 @@
MOCK_METHOD0(OnUserGesture, void());
MOCK_METHOD1(OnPresentationSessionDetached,
void(const MediaRoute::Id& route_id));
- std::unique_ptr<PresentationConnectionStateSubscription>
- AddPresentationConnectionStateChangedCallback(
+ base::CallbackListSubscription AddPresentationConnectionStateChangedCallback(
const MediaRoute::Id& route_id,
const content::PresentationConnectionStateChangedCallback& callback)
override {
diff --git a/components/ntp_tiles/custom_links_manager.h b/components/ntp_tiles/custom_links_manager.h
index e4820f1..3e812108 100644
--- a/components/ntp_tiles/custom_links_manager.h
+++ b/components/ntp_tiles/custom_links_manager.h
@@ -86,8 +86,8 @@
// Registers a callback that will be invoked when custom links are updated by
// sources other than this interface's methods (i.e. when links are deleted by
// history clear or when links are updated by Chrome sync).
- virtual std::unique_ptr<base::CallbackList<void()>::Subscription>
- RegisterCallbackForOnChanged(base::RepeatingClosure callback) = 0;
+ virtual base::CallbackListSubscription RegisterCallbackForOnChanged(
+ base::RepeatingClosure callback) = 0;
};
} // namespace ntp_tiles
diff --git a/components/ntp_tiles/custom_links_manager_impl.cc b/components/ntp_tiles/custom_links_manager_impl.cc
index 70a90e17..aa7c62d3 100644
--- a/components/ntp_tiles/custom_links_manager_impl.cc
+++ b/components/ntp_tiles/custom_links_manager_impl.cc
@@ -191,7 +191,7 @@
[&url](const Link& link) { return link.url == url; });
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
+base::CallbackListSubscription
CustomLinksManagerImpl::RegisterCallbackForOnChanged(
base::RepeatingClosure callback) {
return callback_list_.Add(callback);
diff --git a/components/ntp_tiles/custom_links_manager_impl.h b/components/ntp_tiles/custom_links_manager_impl.h
index d89a146..a739d87 100644
--- a/components/ntp_tiles/custom_links_manager_impl.h
+++ b/components/ntp_tiles/custom_links_manager_impl.h
@@ -53,8 +53,8 @@
bool DeleteLink(const GURL& url) override;
bool UndoAction() override;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- RegisterCallbackForOnChanged(base::RepeatingClosure callback) override;
+ base::CallbackListSubscription RegisterCallbackForOnChanged(
+ base::RepeatingClosure callback) override;
// Register preferences used by this class.
static void RegisterProfilePrefs(
diff --git a/components/ntp_tiles/custom_links_manager_impl_unittest.cc b/components/ntp_tiles/custom_links_manager_impl_unittest.cc
index 794e47e..a62a4d1 100644
--- a/components/ntp_tiles/custom_links_manager_impl_unittest.cc
+++ b/components/ntp_tiles/custom_links_manager_impl_unittest.cc
@@ -447,7 +447,7 @@
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -476,7 +476,7 @@
ShouldDeleteMostVisitedOnAllHistoryDeletion) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -509,7 +509,7 @@
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Delete all Most Visited links.
@@ -529,7 +529,7 @@
TEST_F(CustomLinksManagerImplTest, ShouldNotDeleteCustomLinkOnHistoryDeletion) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -573,7 +573,7 @@
TEST_F(CustomLinksManagerImplTest, ShouldIgnoreHistoryExpiredDeletions) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -607,7 +607,7 @@
TEST_F(CustomLinksManagerImplTest, ShouldIgnoreEmptyHistoryDeletions) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -628,7 +628,7 @@
TEST_F(CustomLinksManagerImplTest, ShouldNotUndoAfterHistoryDeletion) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -660,7 +660,7 @@
TEST_F(CustomLinksManagerImplTest, UpdateListAfterRemoteChange) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -690,7 +690,7 @@
TEST_F(CustomLinksManagerImplTest, InitializeListAfterRemoteChange) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
ASSERT_FALSE(custom_links_->IsInitialized());
@@ -711,7 +711,7 @@
TEST_F(CustomLinksManagerImplTest, UninitializeListAfterRemoteChange) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
@@ -731,7 +731,7 @@
TEST_F(CustomLinksManagerImplTest, ClearThenUninitializeListAfterRemoteChange) {
// Set up Most Visited callback.
base::MockCallback<base::RepeatingClosure> callback;
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription =
+ base::CallbackListSubscription subscription =
custom_links_->RegisterCallbackForOnChanged(callback.Get());
// Initialize.
diff --git a/components/ntp_tiles/most_visited_sites.h b/components/ntp_tiles/most_visited_sites.h
index f21c76e1..85e1096 100644
--- a/components/ntp_tiles/most_visited_sites.h
+++ b/components/ntp_tiles/most_visited_sites.h
@@ -375,9 +375,7 @@
// incremented if custom links was not initialized during this session.
int custom_links_action_count_ = -1;
- std::unique_ptr<
- suggestions::SuggestionsService::ResponseCallbackList::Subscription>
- suggestions_subscription_;
+ base::CallbackListSubscription suggestions_subscription_;
base::ScopedObservation<history::TopSites, history::TopSitesObserver>
top_sites_observation_{this};
@@ -386,8 +384,7 @@
RepeatableQueriesServiceObserver>
repeatable_queries_observation_{this};
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- custom_links_subscription_;
+ base::CallbackListSubscription custom_links_subscription_;
// The main source of personal tiles - either TOP_SITES or SUGGESTIONS_SEVICE.
TileSource mv_source_;
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc
index f7a7da18..440a7ed 100644
--- a/components/ntp_tiles/most_visited_sites_unittest.cc
+++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -202,9 +202,9 @@
MOCK_METHOD0(FetchSuggestionsData, bool());
MOCK_CONST_METHOD0(GetSuggestionsDataFromCache,
base::Optional<SuggestionsProfile>());
- MOCK_METHOD1(AddCallback,
- std::unique_ptr<ResponseCallbackList::Subscription>(
- const ResponseCallback& callback));
+ MOCK_METHOD1(
+ AddCallback,
+ base::CallbackListSubscription(const ResponseCallback& callback));
MOCK_METHOD1(BlocklistURL, bool(const GURL& candidate_url));
MOCK_METHOD1(UndoBlocklistURL, bool(const GURL& url));
MOCK_METHOD0(ClearBlocklist, void());
@@ -283,8 +283,7 @@
MOCK_METHOD1(DeleteLink, bool(const GURL& url));
MOCK_METHOD0(UndoAction, bool());
MOCK_METHOD1(RegisterCallbackForOnChanged,
- std::unique_ptr<base::RepeatingClosureList::Subscription>(
- base::RepeatingClosure callback));
+ base::CallbackListSubscription(base::RepeatingClosure callback));
};
class PopularSitesFactoryForTest {
@@ -1663,8 +1662,8 @@
// Build initial tiles with Top Sites.
base::RepeatingClosure custom_links_callback;
EXPECT_CALL(*mock_custom_links_, RegisterCallbackForOnChanged(_))
- .WillOnce(
- DoAll(SaveArg<0>(&custom_links_callback), Return(ByMove(nullptr))));
+ .WillOnce(DoAll(SaveArg<0>(&custom_links_callback),
+ Return(ByMove(base::CallbackListSubscription()))));
ExpectBuildWithTopSites(
MostVisitedURLList{MakeMostVisitedURL(kTestTitle1, kTestUrl1)},
§ions);
diff --git a/components/omnibox/browser/favicon_cache.h b/components/omnibox/browser/favicon_cache.h
index 6e805858..bc61df50 100644
--- a/components/omnibox/browser/favicon_cache.h
+++ b/components/omnibox/browser/favicon_cache.h
@@ -147,9 +147,7 @@
base::MRUCache<Request, bool> responses_without_favicons_;
// Subscription for notifications of changes to favicons.
- std::unique_ptr<
- history::HistoryService::FaviconsChangedCallbackList::Subscription>
- favicons_changed_subscription_;
+ base::CallbackListSubscription favicons_changed_subscription_;
base::WeakPtrFactory<FaviconCache> weak_factory_{this};
};
diff --git a/components/omnibox/browser/omnibox_event_global_tracker.cc b/components/omnibox/browser/omnibox_event_global_tracker.cc
index db4c7cd..b820052 100644
--- a/components/omnibox/browser/omnibox_event_global_tracker.cc
+++ b/components/omnibox/browser/omnibox_event_global_tracker.cc
@@ -10,9 +10,8 @@
return base::Singleton<OmniboxEventGlobalTracker>::get();
}
-std::unique_ptr<
- OmniboxEventGlobalTracker::OnURLOpenedCallbackList::Subscription>
-OmniboxEventGlobalTracker::RegisterCallback(const OnURLOpenedCallback& cb) {
+base::CallbackListSubscription OmniboxEventGlobalTracker::RegisterCallback(
+ const OnURLOpenedCallback& cb) {
return on_url_opened_callback_list_.Add(cb);
}
diff --git a/components/omnibox/browser/omnibox_event_global_tracker.h b/components/omnibox/browser/omnibox_event_global_tracker.h
index e764e67..fff60a7 100644
--- a/components/omnibox/browser/omnibox_event_global_tracker.h
+++ b/components/omnibox/browser/omnibox_event_global_tracker.h
@@ -32,7 +32,7 @@
static OmniboxEventGlobalTracker* GetInstance();
// Registers |cb| to be invoked when user open an URL from the omnibox.
- std::unique_ptr<OnURLOpenedCallbackList::Subscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const OnURLOpenedCallback& cb);
// Called to notify all registered callbacks that an URL was opened from
diff --git a/components/omnibox/browser/omnibox_metrics_provider.cc b/components/omnibox/browser/omnibox_metrics_provider.cc
index e88b1d2..0a2a7dca 100644
--- a/components/omnibox/browser/omnibox_metrics_provider.cc
+++ b/components/omnibox/browser/omnibox_metrics_provider.cc
@@ -37,7 +37,7 @@
}
void OmniboxMetricsProvider::OnRecordingDisabled() {
- subscription_.reset();
+ subscription_ = {};
}
void OmniboxMetricsProvider::ProvideCurrentSessionData(
diff --git a/components/omnibox/browser/omnibox_metrics_provider.h b/components/omnibox/browser/omnibox_metrics_provider.h
index 31eed83..e9823c20 100644
--- a/components/omnibox/browser/omnibox_metrics_provider.h
+++ b/components/omnibox/browser/omnibox_metrics_provider.h
@@ -39,8 +39,7 @@
void RecordOmniboxOpenedURL(const OmniboxLog& log);
// Subscription for receiving Omnibox event callbacks.
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
// Saved cache of generated Omnibox event protos, to be copied into the UMA
// proto when ProvideCurrentSessionData() is called.
diff --git a/components/omnibox/browser/on_device_head_provider.h b/components/omnibox/browser/on_device_head_provider.h
index 9815c6b..26273b2 100644
--- a/components/omnibox/browser/on_device_head_provider.h
+++ b/components/omnibox/browser/on_device_head_provider.h
@@ -97,11 +97,9 @@
// AutocompleteController.
size_t on_device_search_request_id_;
- // Owns the subscription after adding the model update callback to the
- // listener such that the callback can be removed automatically from the
- // listener on provider's deconstruction.
- std::unique_ptr<OnDeviceModelUpdateListener::UpdateSubscription>
- model_update_subscription_;
+ // Owns the callback added to the listener such that it can be removed
+ // automatically from the listener on provider's deconstruction.
+ base::CallbackListSubscription model_update_subscription_;
base::WeakPtrFactory<OnDeviceHeadProvider> weak_ptr_factory_{this};
};
diff --git a/components/omnibox/browser/on_device_model_update_listener.cc b/components/omnibox/browser/on_device_model_update_listener.cc
index 481fb3c9..1cd0fa23 100644
--- a/components/omnibox/browser/on_device_model_update_listener.cc
+++ b/components/omnibox/browser/on_device_model_update_listener.cc
@@ -48,7 +48,7 @@
OnDeviceModelUpdateListener::~OnDeviceModelUpdateListener() = default;
-std::unique_ptr<OnDeviceModelUpdateListener::UpdateSubscription>
+base::CallbackListSubscription
OnDeviceModelUpdateListener::AddModelUpdateCallback(
ModelUpdateCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
diff --git a/components/omnibox/browser/on_device_model_update_listener.h b/components/omnibox/browser/on_device_model_update_listener.h
index 31f7c0f..e162176 100644
--- a/components/omnibox/browser/on_device_model_update_listener.h
+++ b/components/omnibox/browser/on_device_model_update_listener.h
@@ -26,7 +26,7 @@
// Adds a callback which will be run on model update. This method will also
// notify the provider immediately if a model is available.
- std::unique_ptr<UpdateSubscription> AddModelUpdateCallback(
+ base::CallbackListSubscription AddModelUpdateCallback(
ModelUpdateCallback callback);
// Called by Component Updater when model update is completed to notify the
diff --git a/components/password_manager/core/browser/hash_password_manager.cc b/components/password_manager/core/browser/hash_password_manager.cc
index fc343fe..ed74e3a 100644
--- a/components/password_manager/core/browser/hash_password_manager.cc
+++ b/components/password_manager/core/browser/hash_password_manager.cc
@@ -272,7 +272,7 @@
return false;
}
-std::unique_ptr<StateSubscription> HashPasswordManager::RegisterStateCallback(
+base::CallbackListSubscription HashPasswordManager::RegisterStateCallback(
const base::RepeatingCallback<void(const std::string& username)>&
callback) {
return state_callback_list_.Add(callback);
diff --git a/components/password_manager/core/browser/hash_password_manager.h b/components/password_manager/core/browser/hash_password_manager.h
index 776009af..34bfab4 100644
--- a/components/password_manager/core/browser/hash_password_manager.h
+++ b/components/password_manager/core/browser/hash_password_manager.h
@@ -14,9 +14,6 @@
class PrefService;
-using StateSubscription =
- base::CallbackList<void(const std::string& username)>::Subscription;
-
namespace password_manager {
// Responsible for saving, clearing, retrieving and encryption of a password
@@ -60,7 +57,7 @@
// Should only be called on the UI thread. The callback is only called when
// the sign-in isn't the first change on the |kPasswordHashDataList| and
// saving the password hash actually succeeded.
- virtual std::unique_ptr<StateSubscription> RegisterStateCallback(
+ virtual base::CallbackListSubscription RegisterStateCallback(
const base::RepeatingCallback<void(const std::string& username)>&
callback);
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc
index 48ec5da..94ac2169 100644
--- a/components/password_manager/core/browser/password_store.cc
+++ b/components/password_manager/core/browser/password_store.cc
@@ -636,7 +636,7 @@
base::BindOnce(&PasswordStore::ClearAllNonGmailPasswordHashImpl, this));
}
-std::unique_ptr<StateSubscription>
+base::CallbackListSubscription
PasswordStore::RegisterStateCallbackOnHashPasswordManager(
const base::RepeatingCallback<void(const std::string& username)>&
callback) {
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h
index 2d6f43a1a..ea7f15a 100644
--- a/components/password_manager/core/browser/password_store.h
+++ b/components/password_manager/core/browser/password_store.h
@@ -42,9 +42,6 @@
class ProxyModelTypeControllerDelegate;
} // namespace syncer
-using StateSubscription =
- base::CallbackList<void(const std::string& username)>::Subscription;
-
namespace password_manager {
struct PasswordForm;
@@ -421,7 +418,7 @@
// Adds a listener on |hash_password_manager_| for when |kHashPasswordData|
// list might have changed. Should only be called on the UI thread.
- virtual std::unique_ptr<StateSubscription>
+ virtual base::CallbackListSubscription
RegisterStateCallbackOnHashPasswordManager(
const base::RepeatingCallback<void(const std::string& username)>&
callback);
diff --git a/components/password_manager/ios/password_form_helper.mm b/components/password_manager/ios/password_form_helper.mm
index 35a098f..37fac4f 100644
--- a/components/password_manager/ios/password_form_helper.mm
+++ b/components/password_manager/ios/password_form_helper.mm
@@ -90,7 +90,7 @@
_formActivityObserverBridge;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> _subscription;
+ base::CallbackListSubscription _subscription;
}
#pragma mark - Properties
diff --git a/components/safe_browsing/core/db/database_manager.cc b/components/safe_browsing/core/db/database_manager.cc
index b254a20..89502136 100644
--- a/components/safe_browsing/core/db/database_manager.cc
+++ b/components/safe_browsing/core/db/database_manager.cc
@@ -138,7 +138,7 @@
v4_get_hash_protocol_manager_.reset();
}
-std::unique_ptr<base::RepeatingClosureList::Subscription>
+base::CallbackListSubscription
SafeBrowsingDatabaseManager::RegisterDatabaseUpdatedCallback(
const OnDatabaseUpdated& cb) {
return update_complete_callback_list_.Add(cb);
diff --git a/components/safe_browsing/core/db/database_manager.h b/components/safe_browsing/core/db/database_manager.h
index 9eb022c..c2ec7de 100644
--- a/components/safe_browsing/core/db/database_manager.h
+++ b/components/safe_browsing/core/db/database_manager.h
@@ -260,8 +260,8 @@
// when it's loaded from disk at startup, and then periodically. These
// callbacks will be on the UI thread.
using OnDatabaseUpdated = base::RepeatingClosure;
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- RegisterDatabaseUpdatedCallback(const OnDatabaseUpdated& cb);
+ base::CallbackListSubscription RegisterDatabaseUpdatedCallback(
+ const OnDatabaseUpdated& cb);
// Called to stop or shutdown operations on the io_thread. All subclasses
// should override this method, set enabled_ to false and call the base class
diff --git a/components/search_engines/android/template_url_service_android.cc b/components/search_engines/android/template_url_service_android.cc
index ab52b89d..1c9bc5b 100644
--- a/components/search_engines/android/template_url_service_android.cc
+++ b/components/search_engines/android/template_url_service_android.cc
@@ -119,7 +119,7 @@
}
void TemplateUrlServiceAndroid::OnTemplateURLServiceLoaded() {
- template_url_subscription_.reset();
+ template_url_subscription_ = {};
JNIEnv* env = base::android::AttachCurrentThread();
if (!java_ref_)
return;
diff --git a/components/search_engines/android/template_url_service_android.h b/components/search_engines/android/template_url_service_android.h
index 715bbeb2..4174566 100644
--- a/components/search_engines/android/template_url_service_android.h
+++ b/components/search_engines/android/template_url_service_android.h
@@ -122,7 +122,7 @@
// Pointer to the TemplateUrlService for the main profile.
TemplateURLService* template_url_service_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_;
+ base::CallbackListSubscription template_url_subscription_;
DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid);
};
diff --git a/components/search_engines/template_url_fetcher.cc b/components/search_engines/template_url_fetcher.cc
index d34bb70..03881cce 100644
--- a/components/search_engines/template_url_fetcher.cc
+++ b/components/search_engines/template_url_fetcher.cc
@@ -92,7 +92,7 @@
const GURL osdd_url_;
const GURL favicon_url_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_;
+ base::CallbackListSubscription template_url_subscription_;
DISALLOW_COPY_AND_ASSIGN(RequestDelegate);
};
@@ -164,7 +164,7 @@
}
void TemplateURLFetcher::RequestDelegate::OnLoaded() {
- template_url_subscription_.reset();
+ template_url_subscription_ = {};
if (!template_url_)
return;
AddSearchProvider();
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc
index 120df608..fbe3f41 100644
--- a/components/search_engines/template_url_service.cc
+++ b/components/search_engines/template_url_service.cc
@@ -840,10 +840,9 @@
ChangeToLoadedState();
}
-std::unique_ptr<TemplateURLService::Subscription>
-TemplateURLService::RegisterOnLoadedCallback(
+base::CallbackListSubscription TemplateURLService::RegisterOnLoadedCallback(
const base::RepeatingClosure& callback) {
- return loaded_ ? std::unique_ptr<TemplateURLService::Subscription>()
+ return loaded_ ? base::CallbackListSubscription()
: on_loaded_callbacks_.Add(callback);
}
diff --git a/components/search_engines/template_url_service.h b/components/search_engines/template_url_service.h
index 7f02108..f823333 100644
--- a/components/search_engines/template_url_service.h
+++ b/components/search_engines/template_url_service.h
@@ -80,7 +80,6 @@
using TemplateURLVector = TemplateURL::TemplateURLVector;
using OwnedTemplateURLVector = TemplateURL::OwnedTemplateURLVector;
using SyncDataMap = std::map<std::string, syncer::SyncData>;
- using Subscription = base::CallbackList<void(void)>::Subscription;
// We may want to treat the keyword in a TemplateURL as being a different
// length than it actually is. For example, for keywords that end in a
@@ -319,7 +318,7 @@
// Registers a callback to be called when the service has loaded.
//
// If the service has already loaded, this function does nothing.
- std::unique_ptr<Subscription> RegisterOnLoadedCallback(
+ base::CallbackListSubscription RegisterOnLoadedCallback(
const base::RepeatingClosure& callback);
#if defined(UNIT_TEST)
diff --git a/components/security_interstitials/content/captive_portal_metrics_recorder.h b/components/security_interstitials/content/captive_portal_metrics_recorder.h
index 85a7e16ec..1b4ee91 100644
--- a/components/security_interstitials/content/captive_portal_metrics_recorder.h
+++ b/components/security_interstitials/content/captive_portal_metrics_recorder.h
@@ -40,8 +40,7 @@
bool captive_portal_no_response_;
bool captive_portal_detected_;
- std::unique_ptr<captive_portal::CaptivePortalService::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
};
#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_CAPTIVE_PORTAL_METRICS_RECORDER_H_
diff --git a/components/security_interstitials/content/ssl_error_handler.h b/components/security_interstitials/content/ssl_error_handler.h
index c24b32f..4d8e30c 100644
--- a/components/security_interstitials/content/ssl_error_handler.h
+++ b/components/security_interstitials/content/ssl_error_handler.h
@@ -257,8 +257,7 @@
captive_portal::CaptivePortalService* captive_portal_service_;
#endif
- std::unique_ptr<captive_portal::CaptivePortalService::Subscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
base::OneShotTimer timer_;
diff --git a/components/suggestions/suggestions_service.h b/components/suggestions/suggestions_service.h
index 994ee55..65c2e50 100644
--- a/components/suggestions/suggestions_service.h
+++ b/components/suggestions/suggestions_service.h
@@ -36,7 +36,7 @@
const = 0;
// Adds a callback that is called when the suggestions are updated.
- virtual std::unique_ptr<ResponseCallbackList::Subscription> AddCallback(
+ virtual base::CallbackListSubscription AddCallback(
const ResponseCallback& callback) WARN_UNUSED_RESULT = 0;
// Adds a URL to the blocklist cache, returning true on success or false on
diff --git a/components/suggestions/suggestions_service_impl.cc b/components/suggestions/suggestions_service_impl.cc
index 0cc026a..50af7fe 100644
--- a/components/suggestions/suggestions_service_impl.cc
+++ b/components/suggestions/suggestions_service_impl.cc
@@ -150,8 +150,8 @@
return suggestions;
}
-std::unique_ptr<SuggestionsServiceImpl::ResponseCallbackList::Subscription>
-SuggestionsServiceImpl::AddCallback(const ResponseCallback& callback) {
+base::CallbackListSubscription SuggestionsServiceImpl::AddCallback(
+ const ResponseCallback& callback) {
return callback_list_.Add(callback);
}
diff --git a/components/suggestions/suggestions_service_impl.h b/components/suggestions/suggestions_service_impl.h
index 04b290c..43e7095 100644
--- a/components/suggestions/suggestions_service_impl.h
+++ b/components/suggestions/suggestions_service_impl.h
@@ -68,7 +68,7 @@
bool FetchSuggestionsData() override;
base::Optional<SuggestionsProfile> GetSuggestionsDataFromCache()
const override;
- std::unique_ptr<ResponseCallbackList::Subscription> AddCallback(
+ base::CallbackListSubscription AddCallback(
const ResponseCallback& callback) override WARN_UNUSED_RESULT;
bool BlocklistURL(const GURL& candidate_url) override;
bool UndoBlocklistURL(const GURL& url) override;
diff --git a/components/sync_device_info/device_info_sync_bridge_unittest.cc b/components/sync_device_info/device_info_sync_bridge_unittest.cc
index dca1bd7..da9ac42 100644
--- a/components/sync_device_info/device_info_sync_bridge_unittest.cc
+++ b/components/sync_device_info/device_info_sync_bridge_unittest.cc
@@ -374,10 +374,10 @@
return local_device_info_.get();
}
- std::unique_ptr<Subscription> RegisterOnInitializedCallback(
+ base::CallbackListSubscription RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) override {
NOTIMPLEMENTED();
- return nullptr;
+ return {};
}
private:
diff --git a/components/sync_device_info/fake_local_device_info_provider.cc b/components/sync_device_info/fake_local_device_info_provider.cc
index f89bfb5c0..0a2e2e2 100644
--- a/components/sync_device_info/fake_local_device_info_provider.cc
+++ b/components/sync_device_info/fake_local_device_info_provider.cc
@@ -37,7 +37,7 @@
return ready_ ? &device_info_ : nullptr;
}
-std::unique_ptr<LocalDeviceInfoProvider::Subscription>
+base::CallbackListSubscription
FakeLocalDeviceInfoProvider::RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) {
return callback_list_.Add(callback);
diff --git a/components/sync_device_info/fake_local_device_info_provider.h b/components/sync_device_info/fake_local_device_info_provider.h
index 667a13f..3bedc63b 100644
--- a/components/sync_device_info/fake_local_device_info_provider.h
+++ b/components/sync_device_info/fake_local_device_info_provider.h
@@ -21,7 +21,7 @@
// Overrides for LocalDeviceInfoProvider.
version_info::Channel GetChannel() const override;
const DeviceInfo* GetLocalDeviceInfo() const override;
- std::unique_ptr<Subscription> RegisterOnInitializedCallback(
+ base::CallbackListSubscription RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) override;
void SetReady(bool ready);
diff --git a/components/sync_device_info/local_device_info_provider.h b/components/sync_device_info/local_device_info_provider.h
index 3975f9a..abf9c29 100644
--- a/components/sync_device_info/local_device_info_provider.h
+++ b/components/sync_device_info/local_device_info_provider.h
@@ -19,8 +19,6 @@
// local device.
class LocalDeviceInfoProvider {
public:
- using Subscription = base::CallbackList<void(void)>::Subscription;
-
virtual ~LocalDeviceInfoProvider() = default;
virtual version_info::Channel GetChannel() const = 0;
@@ -32,10 +30,9 @@
virtual const DeviceInfo* GetLocalDeviceInfo() const = 0;
// Registers a callback to be called when local device info becomes available.
- // The callback will remain registered until the
- // returned Subscription is destroyed, which must occur before the
- // CallbackList is destroyed.
- virtual std::unique_ptr<Subscription> RegisterOnInitializedCallback(
+ // The callback will remain registered until the returned subscription is
+ // destroyed, which must occur before the CallbackList is destroyed.
+ virtual base::CallbackListSubscription RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) WARN_UNUSED_RESULT = 0;
};
diff --git a/components/sync_device_info/local_device_info_provider_impl.cc b/components/sync_device_info/local_device_info_provider_impl.cc
index 6d45dfe..8baf8b1 100644
--- a/components/sync_device_info/local_device_info_provider_impl.cc
+++ b/components/sync_device_info/local_device_info_provider_impl.cc
@@ -48,7 +48,7 @@
return local_device_info_.get();
}
-std::unique_ptr<LocalDeviceInfoProvider::Subscription>
+base::CallbackListSubscription
LocalDeviceInfoProviderImpl::RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/components/sync_device_info/local_device_info_provider_impl.h b/components/sync_device_info/local_device_info_provider_impl.h
index f0fd5fa6..08a023e 100644
--- a/components/sync_device_info/local_device_info_provider_impl.h
+++ b/components/sync_device_info/local_device_info_provider_impl.h
@@ -37,7 +37,7 @@
void UpdateClientName(const std::string& client_name) override;
version_info::Channel GetChannel() const override;
const DeviceInfo* GetLocalDeviceInfo() const override;
- std::unique_ptr<Subscription> RegisterOnInitializedCallback(
+ base::CallbackListSubscription RegisterOnInitializedCallback(
const base::RepeatingClosure& callback) override;
private:
diff --git a/components/sync_sessions/session_sync_service.h b/components/sync_sessions/session_sync_service.h
index 9f8f0a05..5d4608ec 100644
--- a/components/sync_sessions/session_sync_service.h
+++ b/components/sync_sessions/session_sync_service.h
@@ -39,9 +39,8 @@
virtual OpenTabsUIDelegate* GetOpenTabsUIDelegate() = 0;
// Allows client code to be notified when foreign sessions change.
- virtual std::unique_ptr<base::CallbackList<void()>::Subscription>
- SubscribeToForeignSessionsChanged(const base::RepeatingClosure& cb)
- WARN_UNUSED_RESULT = 0;
+ virtual base::CallbackListSubscription SubscribeToForeignSessionsChanged(
+ const base::RepeatingClosure& cb) WARN_UNUSED_RESULT = 0;
// For ProfileSyncService to initialize the controller for SESSIONS.
virtual base::WeakPtr<syncer::ModelTypeControllerDelegate>
diff --git a/components/sync_sessions/session_sync_service_impl.cc b/components/sync_sessions/session_sync_service_impl.cc
index 6e532b8a..be79d475 100644
--- a/components/sync_sessions/session_sync_service_impl.cc
+++ b/components/sync_sessions/session_sync_service_impl.cc
@@ -44,7 +44,7 @@
return bridge_->GetOpenTabsUIDelegate();
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
+base::CallbackListSubscription
SessionSyncServiceImpl::SubscribeToForeignSessionsChanged(
const base::RepeatingClosure& cb) {
return foreign_sessions_changed_callback_list_.Add(cb);
diff --git a/components/sync_sessions/session_sync_service_impl.h b/components/sync_sessions/session_sync_service_impl.h
index ac02e94..d34d795 100644
--- a/components/sync_sessions/session_sync_service_impl.h
+++ b/components/sync_sessions/session_sync_service_impl.h
@@ -33,9 +33,8 @@
OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
// Allows client code to be notified when foreign sessions change.
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- SubscribeToForeignSessionsChanged(const base::RepeatingClosure& cb) override
- WARN_UNUSED_RESULT;
+ base::CallbackListSubscription SubscribeToForeignSessionsChanged(
+ const base::RepeatingClosure& cb) override WARN_UNUSED_RESULT;
// For ProfileSyncService to initialize the controller for SESSIONS.
base::WeakPtr<syncer::ModelTypeControllerDelegate> GetControllerDelegate()
diff --git a/components/translate/core/browser/translate_language_list.cc b/components/translate/core/browser/translate_language_list.cc
index b95551a..f781fce 100644
--- a/components/translate/core/browser/translate_language_list.cc
+++ b/components/translate/core/browser/translate_language_list.cc
@@ -254,8 +254,8 @@
}
}
-std::unique_ptr<TranslateLanguageList::EventCallbackList::Subscription>
-TranslateLanguageList::RegisterEventCallback(const EventCallback& callback) {
+base::CallbackListSubscription TranslateLanguageList::RegisterEventCallback(
+ const EventCallback& callback) {
return callback_list_.Add(callback);
}
diff --git a/components/translate/core/browser/translate_language_list.h b/components/translate/core/browser/translate_language_list.h
index 4a949c310..4d726524 100644
--- a/components/translate/core/browser/translate_language_list.h
+++ b/components/translate/core/browser/translate_language_list.h
@@ -61,7 +61,7 @@
// Registers a callback for translate events related to the language list,
// such as updates and download errors.
- std::unique_ptr<EventCallbackList::Subscription> RegisterEventCallback(
+ base::CallbackListSubscription RegisterEventCallback(
const EventCallback& callback);
// Helper methods used by specific unit tests.
diff --git a/components/translate/core/browser/translate_manager.cc b/components/translate/core/browser/translate_manager.cc
index 708408bf..f21ec92 100644
--- a/components/translate/core/browser/translate_manager.cc
+++ b/components/translate/core/browser/translate_manager.cc
@@ -115,8 +115,7 @@
TranslateManager::~TranslateManager() = default;
// static
-std::unique_ptr<TranslateManager::TranslateErrorCallbackList::Subscription>
-TranslateManager::RegisterTranslateErrorCallback(
+base::CallbackListSubscription TranslateManager::RegisterTranslateErrorCallback(
const TranslateManager::TranslateErrorCallback& callback) {
if (!g_error_callback_list_)
g_error_callback_list_ = new TranslateErrorCallbackList;
@@ -124,8 +123,7 @@
}
// static
-std::unique_ptr<TranslateManager::TranslateInitCallbackList::Subscription>
-TranslateManager::RegisterTranslateInitCallback(
+base::CallbackListSubscription TranslateManager::RegisterTranslateInitCallback(
const TranslateManager::TranslateInitCallback& callback) {
if (!g_init_callback_list_)
g_init_callback_list_ = new TranslateInitCallbackList;
diff --git a/components/translate/core/browser/translate_manager.h b/components/translate/core/browser/translate_manager.h
index 628b657..1b4b35a 100644
--- a/components/translate/core/browser/translate_manager.h
+++ b/components/translate/core/browser/translate_manager.h
@@ -162,12 +162,12 @@
using TranslateInitCallback = TranslateInitCallbackList::CallbackType;
// Registers a callback for translate errors.
- static std::unique_ptr<TranslateErrorCallbackList::Subscription>
- RegisterTranslateErrorCallback(const TranslateErrorCallback& callback);
+ static base::CallbackListSubscription RegisterTranslateErrorCallback(
+ const TranslateErrorCallback& callback);
// Registers a callback for translate initialization.
- static std::unique_ptr<TranslateInitCallbackList::Subscription>
- RegisterTranslateInitCallback(const TranslateInitCallback& callback);
+ static base::CallbackListSubscription RegisterTranslateInitCallback(
+ const TranslateInitCallback& callback);
// Gets the LanguageState associated with the TranslateManager
LanguageState* GetLanguageState();
diff --git a/components/translate/ios/browser/language_detection_controller.h b/components/translate/ios/browser/language_detection_controller.h
index e03fb40..c452e75 100644
--- a/components/translate/ios/browser/language_detection_controller.h
+++ b/components/translate/ios/browser/language_detection_controller.h
@@ -80,7 +80,7 @@
web::WebState* web_state_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
JsLanguageDetectionManager* js_manager_;
BooleanPrefMember translate_enabled_;
diff --git a/components/translate/ios/browser/translate_controller.h b/components/translate/ios/browser/translate_controller.h
index dadd0a7b..5ed60cc 100644
--- a/components/translate/ios/browser/translate_controller.h
+++ b/components/translate/ios/browser/translate_controller.h
@@ -127,7 +127,7 @@
std::unique_ptr<network::SimpleURLLoader> script_fetcher_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
Observer* observer_;
__strong JsTranslateManager* js_manager_;
diff --git a/components/translate/translate_internals/translate_internals_handler.cc b/components/translate/translate_internals/translate_internals_handler.cc
index b6441747..df9f009 100644
--- a/components/translate/translate_internals/translate_internals_handler.cc
+++ b/components/translate/translate_internals/translate_internals_handler.cc
@@ -48,10 +48,7 @@
base::Unretained(this)));
}
-TranslateInternalsHandler::~TranslateInternalsHandler() {
- // |event_subscription_|, |error_subscription_| and |init_subscription_| are
- // deleted automatically and un-register the callbacks automatically.
-}
+TranslateInternalsHandler::~TranslateInternalsHandler() = default;
// static.
void TranslateInternalsHandler::GetLanguages(base::DictionaryValue* dict) {
diff --git a/components/translate/translate_internals/translate_internals_handler.h b/components/translate/translate_internals/translate_internals_handler.h
index 5a5b2a8..fb3e60334 100644
--- a/components/translate/translate_internals/translate_internals_handler.h
+++ b/components/translate/translate_internals/translate_internals_handler.h
@@ -99,17 +99,13 @@
void SendCountryToJs(bool was_updated);
// Subscription for translate events coming from the translate language list.
- std::unique_ptr<TranslateLanguageList::EventCallbackList::Subscription>
- event_subscription_;
+ base::CallbackListSubscription event_subscription_;
// Subscription for translate errors coming from the translate manager.
- std::unique_ptr<TranslateManager::TranslateErrorCallbackList::Subscription>
- error_subscription_;
+ base::CallbackListSubscription error_subscription_;
// Subscription for translate initialization event.
- std::unique_ptr<
- translate::TranslateManager::TranslateInitCallbackList::Subscription>
- init_subscription_;
+ base::CallbackListSubscription init_subscription_;
DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler);
};
diff --git a/components/zoom/zoom_controller.cc b/components/zoom/zoom_controller.cc
index 260640a..7cf93f2 100644
--- a/components/zoom/zoom_controller.cc
+++ b/components/zoom/zoom_controller.cc
@@ -344,7 +344,7 @@
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- // If our associated HostZoomMap changes, update our event subscription.
+ // If our associated HostZoomMap changes, update our subscription.
content::HostZoomMap* new_host_zoom_map =
content::HostZoomMap::GetForWebContents(web_contents());
if (new_host_zoom_map == host_zoom_map_)
diff --git a/components/zoom/zoom_controller.h b/components/zoom/zoom_controller.h
index eee38562..5ce1ce1 100644
--- a/components/zoom/zoom_controller.h
+++ b/components/zoom/zoom_controller.h
@@ -194,7 +194,7 @@
// Keep track of the HostZoomMap we're currently subscribed to.
content::HostZoomMap* host_zoom_map_;
- std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
+ base::CallbackListSubscription zoom_subscription_;
WEB_CONTENTS_USER_DATA_KEY_DECL();
diff --git a/components/zoom/zoom_event_manager.cc b/components/zoom/zoom_event_manager.cc
index 29640ac4..5614bbc 100644
--- a/components/zoom/zoom_event_manager.cc
+++ b/components/zoom/zoom_event_manager.cc
@@ -34,8 +34,7 @@
zoom_level_changed_callbacks_.Notify(change);
}
-std::unique_ptr<content::HostZoomMap::Subscription>
-ZoomEventManager::AddZoomLevelChangedCallback(
+base::CallbackListSubscription ZoomEventManager::AddZoomLevelChangedCallback(
content::HostZoomMap::ZoomLevelChangedCallback callback) {
return zoom_level_changed_callbacks_.Add(std::move(callback));
}
diff --git a/components/zoom/zoom_event_manager.h b/components/zoom/zoom_event_manager.h
index 1876f3c..769d4ff2 100644
--- a/components/zoom/zoom_event_manager.h
+++ b/components/zoom/zoom_event_manager.h
@@ -42,8 +42,7 @@
// Add and remove zoom level changed callbacks.
// TODO(wjmaclean): Convert this callback mechanism to use
// ZoomEventManagerObserver instead.
- std::unique_ptr<content::HostZoomMap::Subscription>
- AddZoomLevelChangedCallback(
+ base::CallbackListSubscription AddZoomLevelChangedCallback(
content::HostZoomMap::ZoomLevelChangedCallback callback);
// Called by ZoomLevelDelegates when changes are made to the default zoom
diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc
index abf19eb9..9332680 100644
--- a/content/browser/host_zoom_map_impl.cc
+++ b/content/browser/host_zoom_map_impl.cc
@@ -331,8 +331,7 @@
}
}
-std::unique_ptr<HostZoomMap::Subscription>
-HostZoomMapImpl::AddZoomLevelChangedCallback(
+base::CallbackListSubscription HostZoomMapImpl::AddZoomLevelChangedCallback(
ZoomLevelChangedCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return zoom_level_changed_callbacks_.Add(std::move(callback));
diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h
index 6fe489bf..fb2d6c1 100644
--- a/content/browser/host_zoom_map_impl.h
+++ b/content/browser/host_zoom_map_impl.h
@@ -54,7 +54,7 @@
int render_view_id) override;
double GetDefaultZoomLevel() override;
void SetDefaultZoomLevel(double level) override;
- std::unique_ptr<Subscription> AddZoomLevelChangedCallback(
+ base::CallbackListSubscription AddZoomLevelChangedCallback(
ZoomLevelChangedCallback callback) override;
// Returns the current zoom level for the specified WebContents. This may
diff --git a/content/browser/network_service_instance_impl.cc b/content/browser/network_service_instance_impl.cc
index 9358b38..5675cc8 100644
--- a/content/browser/network_service_instance_impl.cc
+++ b/content/browser/network_service_instance_impl.cc
@@ -397,8 +397,8 @@
return g_network_service_remote->get();
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
-RegisterNetworkServiceCrashHandler(base::RepeatingClosure handler) {
+base::CallbackListSubscription RegisterNetworkServiceCrashHandler(
+ base::RepeatingClosure handler) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!handler.is_null());
diff --git a/content/browser/network_service_instance_impl.h b/content/browser/network_service_instance_impl.h
index b02875a..e590832 100644
--- a/content/browser/network_service_instance_impl.h
+++ b/content/browser/network_service_instance_impl.h
@@ -24,7 +24,7 @@
// mojo::Remote<URLLoaderFactory>).
//
// Can only be called on the UI thread. No-op if NetworkService is disabled.
-CONTENT_EXPORT std::unique_ptr<base::CallbackList<void()>::Subscription>
+CONTENT_EXPORT base::CallbackListSubscription
RegisterNetworkServiceCrashHandler(base::RepeatingClosure handler);
// Corresponds to the "NetworkServiceAvailability" histogram enumeration type in
diff --git a/content/browser/network_service_restart_browsertest.cc b/content/browser/network_service_restart_browsertest.cc
index e361b3c..412cbcc 100644
--- a/content/browser/network_service_restart_browsertest.cc
+++ b/content/browser/network_service_restart_browsertest.cc
@@ -357,10 +357,12 @@
// Register 2 crash handlers.
int counter1 = 0;
int counter2 = 0;
- auto handler1 = RegisterNetworkServiceCrashHandler(
- base::BindRepeating(&IncrementInt, base::Unretained(&counter1)));
- auto handler2 = RegisterNetworkServiceCrashHandler(
- base::BindRepeating(&IncrementInt, base::Unretained(&counter2)));
+ base::CallbackListSubscription subscription1 =
+ RegisterNetworkServiceCrashHandler(
+ base::BindRepeating(&IncrementInt, base::Unretained(&counter1)));
+ base::CallbackListSubscription subscription2 =
+ RegisterNetworkServiceCrashHandler(
+ base::BindRepeating(&IncrementInt, base::Unretained(&counter2)));
// Crash the NetworkService process.
SimulateNetworkServiceCrash();
@@ -381,7 +383,7 @@
EXPECT_TRUE(network_context.is_bound());
// Unregister one of the handlers.
- handler2.reset();
+ subscription2 = {};
// Crash the NetworkService process.
SimulateNetworkServiceCrash();
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index 34667f7..763384c 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -4549,7 +4549,7 @@
void NavigationRequest::StopCommitTimeout() {
commit_timeout_timer_.Stop();
- render_process_blocked_state_changed_subscription_.reset();
+ render_process_blocked_state_changed_subscription_ = {};
GetRenderFrameHost()->GetRenderWidgetHost()->RendererIsResponsive();
}
@@ -4599,7 +4599,7 @@
UMA_HISTOGRAM_BOOLEAN("Navigation.CommitTimeout.IsMainFrame",
frame_tree_node_->IsMainFrame());
base::UmaHistogramSparse("Navigation.CommitTimeout.ErrorCode", -net_error_);
- render_process_blocked_state_changed_subscription_.reset();
+ render_process_blocked_state_changed_subscription_ = {};
GetRenderFrameHost()->GetRenderWidgetHost()->RendererIsUnresponsive(
base::BindRepeating(&NavigationRequest::RestartCommitTimeout,
weak_factory_.GetWeakPtr()));
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h
index 25efdfc..f398fd05 100644
--- a/content/browser/renderer_host/navigation_request.h
+++ b/content/browser/renderer_host/navigation_request.h
@@ -1382,10 +1382,7 @@
// Timer for detecting an unexpectedly long time to commit a navigation.
base::OneShotTimer commit_timeout_timer_;
- // The subscription to the notification of the changing of the render
- // process's blocked state.
- std::unique_ptr<
- RenderProcessHost::BlockStateChangedCallbackList::Subscription>
+ base::CallbackListSubscription
render_process_blocked_state_changed_subscription_;
// The headers used for the request. The value of this comes from
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index c695b50..460905c8 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -681,8 +681,7 @@
return spare_render_process_host_;
}
- std::unique_ptr<base::CallbackList<void(RenderProcessHost*)>::Subscription>
- RegisterSpareRenderProcessHostChangedCallback(
+ base::CallbackListSubscription RegisterSpareRenderProcessHostChangedCallback(
const base::RepeatingCallback<void(RenderProcessHost*)>& cb) {
// Do an initial notification, as the subscriber will need to know what the
// current spare host is.
@@ -1178,10 +1177,9 @@
process->CleanupNetworkServicePluginExceptionsUponDestruction();
- static base::NoDestructor<
- std::unique_ptr<base::CallbackList<void()>::Subscription>>
+ static base::NoDestructor<base::CallbackListSubscription>
s_crash_handler_subscription;
- if (!*s_crash_handler_subscription) {
+ if (!(*s_crash_handler_subscription)) {
*s_crash_handler_subscription = RegisterNetworkServiceCrashHandler(
base::BindRepeating(&OnNetworkServiceCrashRestorePluginExceptions));
}
@@ -3056,7 +3054,7 @@
}
// static
-std::unique_ptr<base::CallbackList<void(RenderProcessHost*)>::Subscription>
+base::CallbackListSubscription
RenderProcessHost::RegisterSpareRenderProcessHostChangedCallback(
const base::RepeatingCallback<void(RenderProcessHost*)>& cb) {
return SpareRenderProcessHostManager::GetInstance()
@@ -3709,7 +3707,7 @@
return is_blocked_;
}
-std::unique_ptr<RenderProcessHost::BlockStateChangedCallbackList::Subscription>
+base::CallbackListSubscription
RenderProcessHostImpl::RegisterBlockStateChangedCallback(
const BlockStateChangedCallback& cb) {
return blocked_state_changed_callback_list_.Add(cb);
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 8a2dea9..379f466 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -202,8 +202,7 @@
bool IsInitializedAndNotDead() override;
void SetBlocked(bool blocked) override;
bool IsBlocked() override;
- std::unique_ptr<base::CallbackList<void(bool)>::Subscription>
- RegisterBlockStateChangedCallback(
+ base::CallbackListSubscription RegisterBlockStateChangedCallback(
const BlockStateChangedCallback& cb) override;
void Cleanup() override;
void AddPendingView() override;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index af1607c..7378a52 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2189,7 +2189,7 @@
// on the renderer to delete Popup widgets.
blink_popup_widget_host_receiver_.reset();
- render_process_blocked_state_changed_subscription_.reset();
+ render_process_blocked_state_changed_subscription_ = {};
pending_show_closure_.Reset();
GetProcess()->RemovePriorityClient(this);
GetProcess()->RemoveObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index fba8cc5..32191b4 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -1235,8 +1235,7 @@
base::OneShotTimer input_event_ack_timeout_;
- std::unique_ptr<
- RenderProcessHost::BlockStateChangedCallbackList::Subscription>
+ base::CallbackListSubscription
render_process_blocked_state_changed_subscription_;
std::unique_ptr<TimeoutMonitor> new_content_rendering_timeout_;
diff --git a/content/public/browser/host_zoom_map.h b/content/public/browser/host_zoom_map.h
index c9d21ad..90658527e 100644
--- a/content/public/browser/host_zoom_map.h
+++ b/content/public/browser/host_zoom_map.h
@@ -183,10 +183,8 @@
using ZoomLevelChangedCallback =
base::RepeatingCallback<void(const ZoomLevelChange&)>;
- typedef base::CallbackList<void(const ZoomLevelChange&)>::Subscription
- Subscription;
// Add and remove zoom level changed callbacks.
- virtual std::unique_ptr<Subscription> AddZoomLevelChangedCallback(
+ virtual base::CallbackListSubscription AddZoomLevelChangedCallback(
ZoomLevelChangedCallback callback) = 0;
virtual void SetClockForTesting(base::Clock* clock) = 0;
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index 941825e..1e09b69 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -287,8 +287,8 @@
using BlockStateChangedCallbackList = base::RepeatingCallbackList<void(bool)>;
using BlockStateChangedCallback = BlockStateChangedCallbackList::CallbackType;
- virtual std::unique_ptr<BlockStateChangedCallbackList::Subscription>
- RegisterBlockStateChangedCallback(const BlockStateChangedCallback& cb) = 0;
+ virtual base::CallbackListSubscription RegisterBlockStateChangedCallback(
+ const BlockStateChangedCallback& cb) = 0;
// Schedules the host for deletion and removes it from the all_hosts list.
virtual void Cleanup() = 0;
@@ -594,8 +594,7 @@
// when the host is ready (RenderProcessHostObserver::RenderProcessReady). If
// the spare RenderProcessHost is promoted to be a "real" RenderProcessHost or
// discarded for any reason, the callback is made with a null pointer.
- static std::unique_ptr<
- base::CallbackList<void(RenderProcessHost*)>::Subscription>
+ static base::CallbackListSubscription
RegisterSpareRenderProcessHostChangedCallback(
const base::RepeatingCallback<void(RenderProcessHost*)>& cb);
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index 145fa18..f308177 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -257,10 +257,10 @@
return false;
}
-std::unique_ptr<RenderProcessHost::BlockStateChangedCallbackList::Subscription>
+base::CallbackListSubscription
MockRenderProcessHost::RegisterBlockStateChangedCallback(
const BlockStateChangedCallback& cb) {
- return nullptr;
+ return {};
}
void MockRenderProcessHost::Cleanup() {
diff --git a/content/public/test/mock_render_process_host.h b/content/public/test/mock_render_process_host.h
index 1fdff0b..859a361 100644
--- a/content/public/test/mock_render_process_host.h
+++ b/content/public/test/mock_render_process_host.h
@@ -112,8 +112,7 @@
bool IsInitializedAndNotDead() override;
void SetBlocked(bool blocked) override;
bool IsBlocked() override;
- std::unique_ptr<BlockStateChangedCallbackList::Subscription>
- RegisterBlockStateChangedCallback(
+ base::CallbackListSubscription RegisterBlockStateChangedCallback(
const BlockStateChangedCallback& cb) override;
void Cleanup() override;
void AddPendingView() override;
diff --git a/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc b/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
index 00e0568..6c16f3e 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
+++ b/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
@@ -192,8 +192,8 @@
MixedRealityInputHelper::~MixedRealityInputHelper() {
// Dispose must be called before destruction, which ensures that we're
// unsubscribed from events.
- DCHECK(pressed_subscription_ == nullptr);
- DCHECK(released_subscription_ == nullptr);
+ DCHECK(!pressed_subscription_);
+ DCHECK(!released_subscription_);
}
void MixedRealityInputHelper::Dispose() {
@@ -412,8 +412,8 @@
void MixedRealityInputHelper::SubscribeEvents() {
DCHECK(input_manager_);
- DCHECK(pressed_subscription_ == nullptr);
- DCHECK(released_subscription_ == nullptr);
+ DCHECK(!pressed_subscription_);
+ DCHECK(!released_subscription_);
// Unretained is safe since we explicitly get disposed and unsubscribe before
// destruction
@@ -426,8 +426,8 @@
}
void MixedRealityInputHelper::UnsubscribeEvents() {
- pressed_subscription_ = nullptr;
- released_subscription_ = nullptr;
+ pressed_subscription_ = {};
+ released_subscription_ = {};
}
} // namespace device
diff --git a/device/vr/windows_mixed_reality/mixed_reality_input_helper.h b/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
index 049e44a..6615524 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
+++ b/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
@@ -58,12 +58,8 @@
void UnsubscribeEvents();
std::unique_ptr<WMRInputManager> input_manager_;
- std::unique_ptr<
- base::CallbackList<void(const WMRInputSourceEventArgs&)>::Subscription>
- pressed_subscription_;
- std::unique_ptr<
- base::CallbackList<void(const WMRInputSourceEventArgs&)>::Subscription>
- released_subscription_;
+ base::CallbackListSubscription pressed_subscription_;
+ base::CallbackListSubscription released_subscription_;
struct ControllerState {
bool pressed = false;
diff --git a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
index 5c2c40c..297f4dc 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
+++ b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
@@ -294,7 +294,7 @@
rendering_params_ = nullptr;
camera_ = nullptr;
- user_presence_changed_subscription_ = nullptr;
+ user_presence_changed_subscription_ = {};
if (input_helper_)
input_helper_->Dispose();
@@ -386,7 +386,7 @@
}
void MixedRealityRenderLoop::ClearStageStatics() {
- stage_changed_subscription_ = nullptr;
+ stage_changed_subscription_ = {};
stage_statics_ = nullptr;
}
diff --git a/device/vr/windows_mixed_reality/mixed_reality_renderloop.h b/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
index 309b30e..c88b520 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
+++ b/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
@@ -123,11 +123,9 @@
std::unique_ptr<MixedRealityInputHelper> input_helper_;
std::unique_ptr<WMRStageStatics> stage_statics_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- stage_changed_subscription_;
+ base::CallbackListSubscription stage_changed_subscription_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- user_presence_changed_subscription_;
+ base::CallbackListSubscription user_presence_changed_subscription_;
std::vector<gfx::Point3F> bounds_;
bool bounds_updated_ = false;
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.cc b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.cc
index b639323..2ed42672 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.cc
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.cc
@@ -65,7 +65,7 @@
return ABI::Windows::Graphics::Holographic::
HolographicSpaceUserPresence_PresentActive;
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
+base::CallbackListSubscription
MockWMRHolographicSpace::AddUserPresenceChangedCallback(
const base::RepeatingCallback<void()>& cb) {
return user_presence_changed_callback_list_.Add(cb);
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.h b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.h
index edad3a0..ed184d6d 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.h
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_holographic_space.h
@@ -23,8 +23,7 @@
override;
ABI::Windows::Graphics::Holographic::HolographicSpaceUserPresence
UserPresence() override;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddUserPresenceChangedCallback(
+ base::CallbackListSubscription AddUserPresenceChangedCallback(
const base::RepeatingCallback<void()>& cb) override;
private:
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.cc b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.cc
index 5ab0c16c..c7fb1ffd 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.cc
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.cc
@@ -94,14 +94,12 @@
return ret;
}
-std::unique_ptr<WMRInputManager::InputEventCallbackList::Subscription>
-MockWMRInputManager::AddPressedCallback(
+base::CallbackListSubscription MockWMRInputManager::AddPressedCallback(
const WMRInputManager::InputEventCallback& cb) {
return pressed_callback_list_.Add(cb);
}
-std::unique_ptr<WMRInputManager::InputEventCallbackList::Subscription>
-MockWMRInputManager::AddReleasedCallback(
+base::CallbackListSubscription MockWMRInputManager::AddReleasedCallback(
const WMRInputManager::InputEventCallback& cb) {
return released_callback_list_.Add(cb);
}
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.h b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.h
index 22943e4..ccce759 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.h
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_input_manager.h
@@ -37,10 +37,10 @@
Microsoft::WRL::ComPtr<ABI::Windows::Perception::IPerceptionTimestamp>
timestamp) override;
- std::unique_ptr<InputEventCallbackList::Subscription> AddPressedCallback(
+ base::CallbackListSubscription AddPressedCallback(
const InputEventCallback& cb) override;
- std::unique_ptr<InputEventCallbackList::Subscription> AddReleasedCallback(
+ base::CallbackListSubscription AddReleasedCallback(
const InputEventCallback& cb) override;
private:
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.cc b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.cc
index 91321d99..44267905 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.cc
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.cc
@@ -67,8 +67,7 @@
return std::make_unique<MockWMRStageOrigin>();
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
-MockWMRStageStatics::AddStageChangedCallback(
+base::CallbackListSubscription MockWMRStageStatics::AddStageChangedCallback(
const base::RepeatingCallback<void()>& cb) {
return callback_list_.Add(cb);
}
diff --git a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.h b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.h
index da375d5..31a30be5 100644
--- a/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.h
+++ b/device/vr/windows_mixed_reality/wrappers/test/mock_wmr_origins.h
@@ -68,8 +68,8 @@
std::unique_ptr<WMRStageOrigin> CurrentStage() override;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddStageChangedCallback(const base::RepeatingCallback<void()>& cb) override;
+ base::CallbackListSubscription AddStageChangedCallback(
+ const base::RepeatingCallback<void()>& cb) override;
private:
base::CallbackList<void()> callback_list_;
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.cc b/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.cc
index e431952..a8ede3c 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.cc
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.cc
@@ -81,7 +81,7 @@
return user_presence;
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
+base::CallbackListSubscription
WMRHolographicSpaceImpl::AddUserPresenceChangedCallback(
const base::RepeatingCallback<void()>& cb) {
return user_presence_changed_callback_list_.Add(cb);
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.h b/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.h
index f63859b1..2846ea8 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.h
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_holographic_space.h
@@ -27,8 +27,8 @@
device) = 0;
virtual ABI::Windows::Graphics::Holographic::HolographicSpaceUserPresence
UserPresence() = 0;
- virtual std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddUserPresenceChangedCallback(const base::RepeatingCallback<void()>& cb) = 0;
+ virtual base::CallbackListSubscription AddUserPresenceChangedCallback(
+ const base::RepeatingCallback<void()>& cb) = 0;
};
class WMRHolographicSpaceImpl : public WMRHolographicSpace {
@@ -47,8 +47,7 @@
override;
ABI::Windows::Graphics::Holographic::HolographicSpaceUserPresence
UserPresence() override;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddUserPresenceChangedCallback(
+ base::CallbackListSubscription AddUserPresenceChangedCallback(
const base::RepeatingCallback<void()>& cb) override;
private:
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.cc b/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.cc
index 727973e..6327dd0 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.cc
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.cc
@@ -102,13 +102,13 @@
return input_states;
}
-std::unique_ptr<WMRInputManager::InputEventCallbackList::Subscription>
-WMRInputManagerImpl::AddPressedCallback(const InputEventCallback& cb) {
+base::CallbackListSubscription WMRInputManagerImpl::AddPressedCallback(
+ const InputEventCallback& cb) {
return pressed_callback_list_.Add(cb);
}
-std::unique_ptr<WMRInputManager::InputEventCallbackList::Subscription>
-WMRInputManagerImpl::AddReleasedCallback(const InputEventCallback& cb) {
+base::CallbackListSubscription WMRInputManagerImpl::AddReleasedCallback(
+ const InputEventCallback& cb) {
return released_callback_list_.Add(cb);
}
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.h b/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.h
index d4cff01..ebdfa8f 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.h
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_input_manager.h
@@ -60,11 +60,11 @@
Microsoft::WRL::ComPtr<ABI::Windows::Perception::IPerceptionTimestamp>
timestamp) = 0;
- virtual std::unique_ptr<InputEventCallbackList::Subscription>
- AddPressedCallback(const InputEventCallback& cb) = 0;
+ virtual base::CallbackListSubscription AddPressedCallback(
+ const InputEventCallback& cb) = 0;
- virtual std::unique_ptr<InputEventCallbackList::Subscription>
- AddReleasedCallback(const InputEventCallback& cb) = 0;
+ virtual base::CallbackListSubscription AddReleasedCallback(
+ const InputEventCallback& cb) = 0;
};
class WMRInputManagerImpl : public WMRInputManager {
@@ -85,10 +85,10 @@
Microsoft::WRL::ComPtr<ABI::Windows::Perception::IPerceptionTimestamp>
timestamp) override;
- std::unique_ptr<InputEventCallbackList::Subscription> AddPressedCallback(
+ base::CallbackListSubscription AddPressedCallback(
const InputEventCallback& cb) override;
- std::unique_ptr<InputEventCallbackList::Subscription> AddReleasedCallback(
+ base::CallbackListSubscription AddReleasedCallback(
const InputEventCallback& cb) override;
private:
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_origins.cc b/device/vr/windows_mixed_reality/wrappers/wmr_origins.cc
index a352bedc..6bc483cb 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_origins.cc
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_origins.cc
@@ -190,8 +190,7 @@
return std::make_unique<WMRStageOriginImpl>(stage_origin);
}
-std::unique_ptr<base::CallbackList<void()>::Subscription>
-WMRStageStaticsImpl::AddStageChangedCallback(
+base::CallbackListSubscription WMRStageStaticsImpl::AddStageChangedCallback(
const base::RepeatingCallback<void()>& cb) {
return callback_list_.Add(cb);
}
diff --git a/device/vr/windows_mixed_reality/wrappers/wmr_origins.h b/device/vr/windows_mixed_reality/wrappers/wmr_origins.h
index a1b161f..207b11d6 100644
--- a/device/vr/windows_mixed_reality/wrappers/wmr_origins.h
+++ b/device/vr/windows_mixed_reality/wrappers/wmr_origins.h
@@ -142,8 +142,8 @@
virtual std::unique_ptr<WMRStageOrigin> CurrentStage() = 0;
- virtual std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddStageChangedCallback(const base::RepeatingCallback<void()>& cb) = 0;
+ virtual base::CallbackListSubscription AddStageChangedCallback(
+ const base::RepeatingCallback<void()>& cb) = 0;
};
class WMRStageStaticsImpl : public WMRStageStatics {
@@ -156,8 +156,8 @@
std::unique_ptr<WMRStageOrigin> CurrentStage() override;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- AddStageChangedCallback(const base::RepeatingCallback<void()>& cb) override;
+ base::CallbackListSubscription AddStageChangedCallback(
+ const base::RepeatingCallback<void()>& cb) override;
private:
HRESULT OnCurrentChanged(IInspectable* sender, IInspectable* args);
diff --git a/docs/patterns/domain-lens.md b/docs/patterns/domain-lens.md
index c2bed7d..d9f85d4b 100644
--- a/docs/patterns/domain-lens.md
+++ b/docs/patterns/domain-lens.md
@@ -85,8 +85,8 @@
class DownloadProgressProvider {
public:
- base::CallbackList::Subscription
- RegisterDownloadProgressCallback(DownloadProgressCallback callback);
+ base::CallbackListSubscription RegisterDownloadProgressCallback(
+ DownloadProgressCallback callback);
DownloadProgress GetCurrentProgress();
};
diff --git a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
index c4e3a724..a62f5da 100644
--- a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
+++ b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
@@ -1113,9 +1113,9 @@
ukm_source_id_(ukm_source_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// base::Unretained is safe here because the callback will be
- // canceled when |shutdown_notifier_| is destroyed, and |proxies_|
- // owns this.
- shutdown_notifier_ =
+ // canceled when |shutdown_notifier_subscription_| is destroyed, and
+ // |proxies_| owns this.
+ shutdown_notifier_subscription_ =
ShutdownNotifierFactory::GetInstance()
->Get(browser_context)
->Subscribe(base::BindRepeating(&WebRequestAPI::ProxySet::RemoveProxy,
diff --git a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h
index 8ca2f314a..fb5c82d 100644
--- a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h
+++ b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h
@@ -339,8 +339,7 @@
std::map<int32_t, uint64_t> network_request_id_to_web_request_id_;
// Notifies the proxy that the browser context has been shutdown.
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_notifier_subscription_;
base::WeakPtrFactory<WebRequestProxyingURLLoaderFactory> weak_factory_{this};
diff --git a/extensions/browser/api/web_request/web_request_proxying_websocket.cc b/extensions/browser/api/web_request/web_request_proxying_websocket.cc
index 850bf5e..c7dd53e 100644
--- a/extensions/browser/api/web_request/web_request_proxying_websocket.cc
+++ b/extensions/browser/api/web_request/web_request_proxying_websocket.cc
@@ -76,8 +76,8 @@
ukm_source_id)),
proxies_(proxies) {
// base::Unretained is safe here because the callback will be canceled when
- // |shutdown_notifier_| is destroyed, and |proxies_| owns this.
- shutdown_notifier_ =
+ // |shutdown_notifier_subscription_| is destroyed, and |proxies_| owns this.
+ shutdown_notifier_subscription_ =
ShutdownNotifierFactory::GetInstance()
->Get(browser_context)
->Subscribe(base::BindRepeating(&WebRequestAPI::ProxySet::RemoveProxy,
diff --git a/extensions/browser/api/web_request/web_request_proxying_websocket.h b/extensions/browser/api/web_request/web_request_proxying_websocket.h
index cc29375..3d81d75 100644
--- a/extensions/browser/api/web_request/web_request_proxying_websocket.h
+++ b/extensions/browser/api/web_request/web_request_proxying_websocket.h
@@ -160,8 +160,7 @@
WebRequestAPI::ProxySet* const proxies_;
// Notifies the proxy that the browser context has been shutdown.
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_notifier_subscription_;
base::WeakPtrFactory<WebRequestProxyingWebSocket> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WebRequestProxyingWebSocket);
diff --git a/extensions/browser/extension_message_filter.cc b/extensions/browser/extension_message_filter.cc
index 7492592..f4f400b 100644
--- a/extensions/browser/extension_message_filter.cc
+++ b/extensions/browser/extension_message_filter.cc
@@ -65,7 +65,7 @@
render_process_id_(render_process_id),
browser_context_(context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- shutdown_notifier_ =
+ shutdown_notifier_subscription_ =
ShutdownNotifierFactory::GetInstance()->Get(context)->Subscribe(
base::Bind(&ExtensionMessageFilter::ShutdownOnUIThread,
base::Unretained(this)));
@@ -86,7 +86,7 @@
void ExtensionMessageFilter::ShutdownOnUIThread() {
browser_context_ = nullptr;
- shutdown_notifier_.reset();
+ shutdown_notifier_subscription_ = {};
}
void ExtensionMessageFilter::OverrideThreadForMessage(
diff --git a/extensions/browser/extension_message_filter.h b/extensions/browser/extension_message_filter.h
index baf728f..4b08bb99 100644
--- a/extensions/browser/extension_message_filter.h
+++ b/extensions/browser/extension_message_filter.h
@@ -125,8 +125,7 @@
const int render_process_id_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- shutdown_notifier_;
+ base::CallbackListSubscription shutdown_notifier_subscription_;
// Only access from the UI thread.
content::BrowserContext* browser_context_;
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index 1841283..3ca069f 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -798,8 +798,7 @@
const int render_process_id_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
- std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
- browser_context_shutdown_subscription_;
+ base::CallbackListSubscription browser_context_shutdown_subscription_;
DISALLOW_COPY_AND_ASSIGN(ExtensionURLLoaderFactory);
};
diff --git a/extensions/test/extension_test_notification_observer.cc b/extensions/test/extension_test_notification_observer.cc
index 720b2fe..43f38e8 100644
--- a/extensions/test/extension_test_notification_observer.cc
+++ b/extensions/test/extension_test_notification_observer.cc
@@ -189,7 +189,7 @@
base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
- std::unique_ptr<base::CallbackList<void()>::Subscription> subscription;
+ base::CallbackListSubscription subscription;
if (notification_set) {
subscription = notification_set->callback_list().Add(base::BindRepeating(
&ExtensionTestNotificationObserver::MaybeQuit, base::Unretained(this)));
diff --git a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
index d0d767bd..7d113b3b 100644
--- a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
+++ b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
@@ -50,9 +50,7 @@
syncer::SyncService* _syncService; // weak
scoped_refptr<history::TopSites> _topSites;
- std::unique_ptr<
- suggestions::SuggestionsService::ResponseCallbackList::Subscription>
- _suggestionsServiceResponseSubscription;
+ base::CallbackListSubscription _suggestionsServiceResponseSubscription;
// Indicates if a reindex is pending. Reindexes made by calling the external
// reindexTopSites method are executed at most every second.
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.h b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.h
index 7454c796..b728385 100644
--- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.h
+++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.h
@@ -128,7 +128,7 @@
// Used if we need to clear history.
base::CancelableTaskTracker history_task_tracker_;
- std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_;
+ base::CallbackListSubscription template_url_subscription_;
base::WeakPtrFactory<BrowsingDataRemoverImpl> weak_ptr_factory_;
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
index d5b2c64..42a9369d 100644
--- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
+++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
@@ -607,7 +607,7 @@
TemplateURLService* model =
ios::TemplateURLServiceFactory::GetForBrowserState(browser_state_);
model->RemoveAutoGeneratedBetween(delete_begin, delete_end);
- template_url_subscription_.reset();
+ template_url_subscription_ = {};
std::move(callback).Run();
}
diff --git a/ios/chrome/browser/history/history_client_impl.cc b/ios/chrome/browser/history/history_client_impl.cc
index 8033e9d..61dcdb4 100644
--- a/ios/chrome/browser/history/history_client_impl.cc
+++ b/ios/chrome/browser/history/history_client_impl.cc
@@ -45,7 +45,7 @@
}
void HistoryClientImpl::Shutdown() {
- favicons_changed_subscription_.reset();
+ favicons_changed_subscription_ = {};
StopObservingBookmarkModel();
}
diff --git a/ios/chrome/browser/history/history_client_impl.h b/ios/chrome/browser/history/history_client_impl.h
index b12c7c0..1fa4803 100644
--- a/ios/chrome/browser/history/history_client_impl.h
+++ b/ios/chrome/browser/history/history_client_impl.h
@@ -59,9 +59,7 @@
base::RepeatingCallback<void(const std::set<GURL>&)> on_bookmarks_removed_;
// Subscription for notifications of changes to favicons.
- std::unique_ptr<
- history::HistoryService::FaviconsChangedCallbackList::Subscription>
- favicons_changed_subscription_;
+ base::CallbackListSubscription favicons_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(HistoryClientImpl);
};
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h
index 556337c..8ebd3d8 100644
--- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h
@@ -155,13 +155,11 @@
base::OnceClosure collect_final_metrics_done_callback_;
// Subscription for receiving callbacks that a tab was parented.
- std::unique_ptr<base::CallbackList<void(web::WebState*)>::Subscription>
- tab_parented_subscription_;
+ base::CallbackListSubscription tab_parented_subscription_;
// Subscription for receiving callbacks that a URL was opened from the
// omnibox.
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- omnibox_url_opened_subscription_;
+ base::CallbackListSubscription omnibox_url_opened_subscription_;
base::WeakPtrFactory<IOSChromeMetricsServiceClient> weak_ptr_factory_;
diff --git a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
index c8edbdc..82e438f 100644
--- a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
+++ b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
@@ -129,7 +129,7 @@
if (!log->is_popup_open)
return;
- on_omnibox_url_opened_subscription_.reset();
+ on_omnibox_url_opened_subscription_ = {};
if (!on_omnibox_search_callback_.is_null())
std::move(on_omnibox_search_callback_).Run();
diff --git a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h
index 02de2ec..e7c17489 100644
--- a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h
+++ b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h
@@ -46,8 +46,7 @@
void OnURLOpenedFromOmnibox(OmniboxLog* log);
base::OnceClosure on_omnibox_search_callback_;
- std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
- on_omnibox_url_opened_subscription_;
+ base::CallbackListSubscription on_omnibox_url_opened_subscription_;
DISALLOW_COPY_AND_ASSIGN(RLZTrackerDelegateImpl);
};
diff --git a/ios/chrome/browser/search_engines/search_engine_js_unittest.mm b/ios/chrome/browser/search_engines/search_engine_js_unittest.mm
index 0aa35b1..29750d5 100644
--- a/ios/chrome/browser/search_engines/search_engine_js_unittest.mm
+++ b/ios/chrome/browser/search_engines/search_engine_js_unittest.mm
@@ -83,7 +83,7 @@
bool message_received_ = false;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(SearchEngineJsTest);
};
diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper.h b/ios/chrome/browser/search_engines/search_engine_tab_helper.h
index 5ac8c9d..330d6f16 100644
--- a/ios/chrome/browser/search_engines/search_engine_tab_helper.h
+++ b/ios/chrome/browser/search_engines/search_engine_tab_helper.h
@@ -86,7 +86,7 @@
GURL searchable_url_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
WEB_STATE_USER_DATA_KEY_DECL();
diff --git a/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.h b/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.h
index 9c8af5d..42aef0f 100644
--- a/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.h
+++ b/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.h
@@ -99,8 +99,7 @@
sync_sessions::SyncSessionsClient* const sessions_client_;
syncer::SyncableService::StartSyncFlare flare_;
- std::unique_ptr<base::CallbackList<void(web::WebState*)>::Subscription>
- tab_parented_subscription_;
+ base::CallbackListSubscription tab_parented_subscription_;
// Track the number of WebStateList we are observing that are in a batch
// operation.
diff --git a/ios/chrome/browser/tabs/tab_parenting_global_observer.cc b/ios/chrome/browser/tabs/tab_parenting_global_observer.cc
index 8aa1996..0ad9f32 100644
--- a/ios/chrome/browser/tabs/tab_parenting_global_observer.cc
+++ b/ios/chrome/browser/tabs/tab_parenting_global_observer.cc
@@ -11,8 +11,8 @@
return instance.get();
}
-std::unique_ptr<base::CallbackList<void(web::WebState*)>::Subscription>
-TabParentingGlobalObserver::RegisterCallback(const OnTabParentedCallback& cb) {
+base::CallbackListSubscription TabParentingGlobalObserver::RegisterCallback(
+ const OnTabParentedCallback& cb) {
return on_tab_parented_callback_list_.Add(cb);
}
diff --git a/ios/chrome/browser/tabs/tab_parenting_global_observer.h b/ios/chrome/browser/tabs/tab_parenting_global_observer.h
index f47c96be..6fbda6a 100644
--- a/ios/chrome/browser/tabs/tab_parenting_global_observer.h
+++ b/ios/chrome/browser/tabs/tab_parenting_global_observer.h
@@ -26,8 +26,8 @@
static TabParentingGlobalObserver* GetInstance();
// Registers |cb| to be invoked when a tab is parented.
- std::unique_ptr<base::CallbackList<void(web::WebState*)>::Subscription>
- RegisterCallback(const OnTabParentedCallback& cb);
+ base::CallbackListSubscription RegisterCallback(
+ const OnTabParentedCallback& cb);
// Called to notify all registered callbacks that |web_state| was parented.
void OnTabParented(web::WebState* web_state);
diff --git a/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm b/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
index 6307095..58145d3 100644
--- a/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
+++ b/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
@@ -283,7 +283,7 @@
std::vector<std::unique_ptr<base::DictionaryValue>> commands_received_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
};
// Tests if |__gCrWeb.languageDetection.detectLanguage| correctly informs the
diff --git a/ios/chrome/browser/ui/recent_tabs/recent_tabs_coordinator_unittest.mm b/ios/chrome/browser/ui/recent_tabs/recent_tabs_coordinator_unittest.mm
index c1319561..e3fb21a 100644
--- a/ios/chrome/browser/ui/recent_tabs/recent_tabs_coordinator_unittest.mm
+++ b/ios/chrome/browser/ui/recent_tabs/recent_tabs_coordinator_unittest.mm
@@ -65,9 +65,9 @@
MOCK_CONST_METHOD0(GetGlobalIdMapper, syncer::GlobalIdMapper*());
MOCK_METHOD0(GetOpenTabsUIDelegate, sync_sessions::OpenTabsUIDelegate*());
- MOCK_METHOD1(SubscribeToForeignSessionsChanged,
- std::unique_ptr<base::CallbackList<void()>::Subscription>(
- const base::RepeatingClosure& cb));
+ MOCK_METHOD1(
+ SubscribeToForeignSessionsChanged,
+ base::CallbackListSubscription(const base::RepeatingClosure& cb));
MOCK_METHOD0(ScheduleGarbageCollection, void());
MOCK_METHOD0(GetControllerDelegate,
base::WeakPtr<syncer::ModelTypeControllerDelegate>());
diff --git a/ios/chrome/browser/ui/recent_tabs/synced_sessions_bridge.h b/ios/chrome/browser/ui/recent_tabs/synced_sessions_bridge.h
index dabad13..cbe8a5bc 100644
--- a/ios/chrome/browser/ui/recent_tabs/synced_sessions_bridge.h
+++ b/ios/chrome/browser/ui/recent_tabs/synced_sessions_bridge.h
@@ -48,8 +48,7 @@
signin::IdentityManager* identity_manager_ = nullptr;
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
identity_manager_observer_;
- std::unique_ptr<base::CallbackList<void()>::Subscription>
- foreign_session_updated_subscription_;
+ base::CallbackListSubscription foreign_session_updated_subscription_;
DISALLOW_COPY_AND_ASSIGN(SyncedSessionsObserverBridge);
};
diff --git a/ios/chrome/browser/web/image_fetch_js_unittest.mm b/ios/chrome/browser/web/image_fetch_js_unittest.mm
index 5fd7966..5f18d04 100644
--- a/ios/chrome/browser/web/image_fetch_js_unittest.mm
+++ b/ios/chrome/browser/web/image_fetch_js_unittest.mm
@@ -100,7 +100,7 @@
}
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
net::EmbeddedTestServer server_;
base::Value message_;
diff --git a/ios/chrome/browser/web/image_fetch_tab_helper.h b/ios/chrome/browser/web/image_fetch_tab_helper.h
index 260350f..0f154feb 100644
--- a/ios/chrome/browser/web/image_fetch_tab_helper.h
+++ b/ios/chrome/browser/web/image_fetch_tab_helper.h
@@ -104,7 +104,7 @@
int call_id_ = 0;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
base::WeakPtrFactory<ImageFetchTabHelper> weak_ptr_factory_;
diff --git a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h b/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h
index ce49235..cdedeb2d 100644
--- a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h
+++ b/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h
@@ -43,7 +43,7 @@
JavaScriptConsoleTabHelperDelegate* delegate_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
// The WebState this instance is observing. Will be null after
// WebStateDestroyed has been called.
diff --git a/ios/chrome/browser/web/print_tab_helper.h b/ios/chrome/browser/web/print_tab_helper.h
index 91e8ba4..8304d0a 100644
--- a/ios/chrome/browser/web/print_tab_helper.h
+++ b/ios/chrome/browser/web/print_tab_helper.h
@@ -42,7 +42,7 @@
__weak id<WebStatePrinter> printer_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
WEB_STATE_USER_DATA_KEY_DECL();
diff --git a/ios/chrome/test/wpt/cwt_webdriver_app_interface.mm b/ios/chrome/test/wpt/cwt_webdriver_app_interface.mm
index 86a26cd..74f7a8e 100644
--- a/ios/chrome/test/wpt/cwt_webdriver_app_interface.mm
+++ b/ios/chrome/test/wpt/cwt_webdriver_app_interface.mm
@@ -192,8 +192,7 @@
});
__block BOOL webStateFound = NO;
- __block std::unique_ptr<web::WebState::ScriptCommandSubscription>
- subscription;
+ __block base::CallbackListSubscription subscription;
grey_dispatch_sync_on_main_thread(^{
web::WebState* webState = GetWebStateWithId(tabID);
if (!webState)
diff --git a/ios/components/security_interstitials/ios_blocking_page_tab_helper.h b/ios/components/security_interstitials/ios_blocking_page_tab_helper.h
index 4f70a2054..238a5ce7 100644
--- a/ios/components/security_interstitials/ios_blocking_page_tab_helper.h
+++ b/ios/components/security_interstitials/ios_blocking_page_tab_helper.h
@@ -94,7 +94,7 @@
blocking_page_for_currently_committed_navigation_;
// Subscription for JS messages.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
// Helper object that notifies the tab helper of committed navigation IDs.
CommittedNavigationIDListener navigation_id_listener_;
diff --git a/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm b/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm
index dc9dbf3..f207fc4 100644
--- a/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm
+++ b/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm
@@ -27,7 +27,7 @@
#pragma mark - IOSBlockingPageTabHelper
IOSBlockingPageTabHelper::IOSBlockingPageTabHelper(web::WebState* web_state)
- : subscription_(nullptr), navigation_id_listener_(web_state, this) {
+ : navigation_id_listener_(web_state, this) {
auto command_callback =
base::BindRepeating(&IOSBlockingPageTabHelper::OnBlockingPageCommand,
weak_factory_.GetWeakPtr());
diff --git a/ios/net/cookies/cookie_store_ios.h b/ios/net/cookies/cookie_store_ios.h
index 630dca94..ffd9f5a 100644
--- a/ios/net/cookies/cookie_store_ios.h
+++ b/ios/net/cookies/cookie_store_ios.h
@@ -131,14 +131,13 @@
class Subscription : public base::LinkNode<Subscription>,
public CookieChangeSubscription {
public:
- explicit Subscription(
- std::unique_ptr<CookieChangeCallbackList::Subscription> subscription);
+ explicit Subscription(base::CallbackListSubscription subscription);
~Subscription() override;
void ResetSubscription();
private:
- std::unique_ptr<CookieChangeCallbackList::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(Subscription);
};
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
index 600c642..aee5601f 100644
--- a/ios/net/cookies/cookie_store_ios.mm
+++ b/ios/net/cookies/cookie_store_ios.mm
@@ -131,7 +131,7 @@
#pragma mark CookieStoreIOS::Subscription
CookieStoreIOS::Subscription::Subscription(
- std::unique_ptr<CookieChangeCallbackList::Subscription> subscription)
+ base::CallbackListSubscription subscription)
: subscription_(std::move(subscription)) {
DCHECK(subscription_);
}
@@ -147,7 +147,7 @@
}
void CookieStoreIOS::Subscription::ResetSubscription() {
- subscription_.reset();
+ subscription_ = {};
}
#pragma mark -
diff --git a/ios/web/favicon/favicon_manager.h b/ios/web/favicon/favicon_manager.h
index 710bebc..221278d 100644
--- a/ios/web/favicon/favicon_manager.h
+++ b/ios/web/favicon/favicon_manager.h
@@ -29,7 +29,7 @@
WebStateImpl* web_state_impl_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(FaviconManager);
};
diff --git a/ios/web/js_messaging/web_frame_impl.h b/ios/web/js_messaging/web_frame_impl.h
index 3d4626a..c366ab9e 100644
--- a/ios/web/js_messaging/web_frame_impl.h
+++ b/ios/web/js_messaging/web_frame_impl.h
@@ -144,7 +144,7 @@
// The associated web state.
web::WebState* web_state_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
base::WeakPtrFactory<WebFrameImpl> weak_ptr_factory_;
diff --git a/ios/web/navigation/crw_js_navigation_handler.mm b/ios/web/navigation/crw_js_navigation_handler.mm
index fb8350bf..64e017b 100644
--- a/ios/web/navigation/crw_js_navigation_handler.mm
+++ b/ios/web/navigation/crw_js_navigation_handler.mm
@@ -39,7 +39,7 @@
@interface CRWJSNavigationHandler () {
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> _subscription;
+ base::CallbackListSubscription _subscription;
}
@property(nonatomic, weak) id<CRWJSNavigationHandlerDelegate> delegate;
diff --git a/ios/web/navigation/crw_text_fragments_handler.mm b/ios/web/navigation/crw_text_fragments_handler.mm
index af683b5..8e54273 100644
--- a/ios/web/navigation/crw_text_fragments_handler.mm
+++ b/ios/web/navigation/crw_text_fragments_handler.mm
@@ -31,7 +31,7 @@
} // namespace
@interface CRWTextFragmentsHandler () {
- std::unique_ptr<web::WebState::ScriptCommandSubscription> _subscription;
+ base::CallbackListSubscription _subscription;
}
@property(nonatomic, weak) id<CRWWebViewHandlerDelegate> delegate;
diff --git a/ios/web/navigation/crw_text_fragments_handler_unittest.mm b/ios/web/navigation/crw_text_fragments_handler_unittest.mm
index aa66321..d49a06a 100644
--- a/ios/web/navigation/crw_text_fragments_handler_unittest.mm
+++ b/ios/web/navigation/crw_text_fragments_handler_unittest.mm
@@ -52,12 +52,12 @@
MOCK_METHOD1(ExecuteJavaScript, void(const base::string16&));
MOCK_CONST_METHOD0(GetLastCommittedURL, const GURL&());
- std::unique_ptr<web::WebState::ScriptCommandSubscription>
- AddScriptCommandCallback(const web::WebState::ScriptCommandCallback& callback,
- const std::string& command_prefix) override {
+ base::CallbackListSubscription AddScriptCommandCallback(
+ const web::WebState::ScriptCommandCallback& callback,
+ const std::string& command_prefix) override {
last_callback_ = callback;
last_command_prefix_ = command_prefix;
- return nil;
+ return {};
}
web::WebState::ScriptCommandCallback last_callback() {
diff --git a/ios/web/public/test/earl_grey/web_view_actions.mm b/ios/web/public/test/earl_grey/web_view_actions.mm
index 8ed49b0..a3530375 100644
--- a/ios/web/public/test/earl_grey/web_view_actions.mm
+++ b/ios/web/public/test/earl_grey/web_view_actions.mm
@@ -40,11 +40,11 @@
// Generic verification injector. Injects one-time mousedown verification into
// |web_state| that will set the boolean pointed to by |verified| to true when
// |web_state|'s webview registers the mousedown event.
-std::unique_ptr<web::WebState::ScriptCommandSubscription>
-AddVerifierToElementWithPrefix(web::WebState* web_state,
- ElementSelector* selector,
- const std::string& prefix,
- bool* verified) {
+base::CallbackListSubscription AddVerifierToElementWithPrefix(
+ web::WebState* web_state,
+ ElementSelector* selector,
+ const std::string& prefix,
+ bool* verified) {
const char kCallbackCommand[] = "verified";
const std::string kCallbackInvocation = prefix + '.' + kCallbackCommand;
@@ -90,7 +90,7 @@
});
if (!success)
- return nullptr;
+ return {};
// The callback doesn't care about any of the parameters, just whether it is
// called or not.
@@ -167,8 +167,7 @@
// reference.
__block bool verified = false;
- __block std::unique_ptr<web::WebState::ScriptCommandSubscription>
- subscription;
+ __block base::CallbackListSubscription subscription;
// GREYPerformBlock executes on background thread by default in EG2.
// Dispatch any call involving UI API to UI thread as they can't be executed
// on background thread. See go/eg2-migration#greyactions-threading-behavior
diff --git a/ios/web/public/test/fakes/test_web_state.h b/ios/web/public/test/fakes/test_web_state.h
index 7406a38..7fe63b5 100644
--- a/ios/web/public/test/fakes/test_web_state.h
+++ b/ios/web/public/test/fakes/test_web_state.h
@@ -73,7 +73,7 @@
const GURL& GetVisibleURL() const override;
const GURL& GetLastCommittedURL() const override;
GURL GetCurrentURL(URLVerificationTrustLevel* trust_level) const override;
- std::unique_ptr<ScriptCommandSubscription> AddScriptCommandCallback(
+ base::CallbackListSubscription AddScriptCommandCallback(
const ScriptCommandCallback& callback,
const std::string& command_prefix) override;
CRWWebViewProxyType GetWebViewProxy() const override;
diff --git a/ios/web/public/test/fakes/test_web_state.mm b/ios/web/public/test/fakes/test_web_state.mm
index 7fc398f6..4ac85b5 100644
--- a/ios/web/public/test/fakes/test_web_state.mm
+++ b/ios/web/public/test/fakes/test_web_state.mm
@@ -231,9 +231,9 @@
return url_;
}
-std::unique_ptr<WebState::ScriptCommandSubscription>
-TestWebState::AddScriptCommandCallback(const ScriptCommandCallback& callback,
- const std::string& command_prefix) {
+base::CallbackListSubscription TestWebState::AddScriptCommandCallback(
+ const ScriptCommandCallback& callback,
+ const std::string& command_prefix) {
return callback_list_.Add(callback);
}
diff --git a/ios/web/public/test/js_test_storage_util.mm b/ios/web/public/test/js_test_storage_util.mm
index a14483a..fa907446a 100644
--- a/ios/web/public/test/js_test_storage_util.mm
+++ b/ios/web/public/test/js_test_storage_util.mm
@@ -147,7 +147,7 @@
// when the async is done, so listen for that here.
__block bool async_success = false;
__block NSString* block_error_message;
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
web_state->AddScriptCommandCallback(
base::BindRepeating(^(const base::DictionaryValue& message,
const GURL& page_url, bool user_is_interacting,
@@ -197,7 +197,7 @@
__block bool async_success = false;
__block NSString* block_result;
__block NSString* block_error_message;
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_ =
+ base::CallbackListSubscription subscription_ =
web_state->AddScriptCommandCallback(
base::BindRepeating(^(const base::DictionaryValue& message,
const GURL& page_url, bool user_is_interacting,
diff --git a/ios/web/public/web_state.h b/ios/web/public/web_state.h
index 0ce75f5..661ac7ea 100644
--- a/ios/web/public/web_state.h
+++ b/ios/web/public/web_state.h
@@ -329,15 +329,13 @@
web::WebFrame* sender_frame);
using ScriptCommandCallback =
base::RepeatingCallback<ScriptCommandCallbackSignature>;
- using ScriptCommandSubscription =
- base::RepeatingCallbackList<ScriptCommandCallbackSignature>::Subscription;
// Registers |callback| for JS message whose 'command' matches
- // |command_prefix|. The returned ScriptCommandSubscription should be stored
- // by the caller. When the description object is destroyed, it will unregister
- // |callback| if this WebState is still alive, and do nothing if this WebState
- // is already destroyed. Therefore if the caller want to stop receiving JS
- // messages it can just destroy the subscription object.
- virtual std::unique_ptr<ScriptCommandSubscription> AddScriptCommandCallback(
+ // |command_prefix|. The returned subscription should be stored by the caller.
+ // When the description object is destroyed, it will unregister |callback| if
+ // this WebState is still alive, and do nothing if this WebState is already
+ // destroyed. Therefore if the caller want to stop receiving JS messages it
+ // can just destroy the subscription.
+ virtual base::CallbackListSubscription AddScriptCommandCallback(
const ScriptCommandCallback& callback,
const std::string& command_prefix) WARN_UNUSED_RESULT = 0;
diff --git a/ios/web/web_state/ui/cookie_blocking_error_logger.h b/ios/web/web_state/ui/cookie_blocking_error_logger.h
index f20b7d67..0369593 100644
--- a/ios/web/web_state/ui/cookie_blocking_error_logger.h
+++ b/ios/web/web_state/ui/cookie_blocking_error_logger.h
@@ -37,7 +37,7 @@
WebState* web_state_impl_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
};
} // namespace web
diff --git a/ios/web/web_state/ui/js_window_error_manager.h b/ios/web/web_state/ui/js_window_error_manager.h
index c90ce204..04313b89a 100644
--- a/ios/web/web_state/ui/js_window_error_manager.h
+++ b/ios/web/web_state/ui/js_window_error_manager.h
@@ -32,7 +32,7 @@
WebState* web_state_impl_ = nullptr;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
DISALLOW_COPY_AND_ASSIGN(JsWindowErrorManager);
};
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h
index 83b29e0d..44ac91c 100644
--- a/ios/web/web_state/web_state_impl.h
+++ b/ios/web/web_state/web_state_impl.h
@@ -221,7 +221,7 @@
GURL GetCurrentURL(URLVerificationTrustLevel* trust_level) const override;
bool IsShowingWebInterstitial() const override;
WebInterstitial* GetWebInterstitial() const override;
- std::unique_ptr<ScriptCommandSubscription> AddScriptCommandCallback(
+ base::CallbackListSubscription AddScriptCommandCallback(
const ScriptCommandCallback& callback,
const std::string& command_prefix) override;
id<CRWWebViewProxy> GetWebViewProxy() const override;
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index c9b2703..98650b0 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -774,9 +774,9 @@
return result;
}
-std::unique_ptr<WebState::ScriptCommandSubscription>
-WebStateImpl::AddScriptCommandCallback(const ScriptCommandCallback& callback,
- const std::string& command_prefix) {
+base::CallbackListSubscription WebStateImpl::AddScriptCommandCallback(
+ const ScriptCommandCallback& callback,
+ const std::string& command_prefix) {
DCHECK(!command_prefix.empty());
DCHECK(command_prefix.find_first_of('.') == std::string::npos);
DCHECK(script_command_callbacks_.count(command_prefix) == 0 ||
diff --git a/ios/web/web_state/web_state_impl_unittest.mm b/ios/web/web_state/web_state_impl_unittest.mm
index cb62f36..63212d27 100644
--- a/ios/web/web_state/web_state_impl_unittest.mm
+++ b/ios/web/web_state/web_state_impl_unittest.mm
@@ -817,10 +817,12 @@
const GURL kUrl1("http://foo");
bool is_called_1 = false;
web::FakeMainWebFrame main_frame(GURL::EmptyGURL());
- auto subscription_1 = web_state_->AddScriptCommandCallback(
- base::BindRepeating(&HandleScriptCommand, &is_called_1, &value_1, kUrl1,
- /*expected_user_is_interacting*/ false, &main_frame),
- kPrefix1);
+ base::CallbackListSubscription subscription_1 =
+ web_state_->AddScriptCommandCallback(
+ base::BindRepeating(
+ &HandleScriptCommand, &is_called_1, &value_1, kUrl1,
+ /*expected_user_is_interacting*/ false, &main_frame),
+ kPrefix1);
const std::string kPrefix2("prefix2");
const std::string kCommand2("prefix2.command2");
@@ -828,10 +830,12 @@
value_2.SetString("c", "d");
const GURL kUrl2("http://bar");
bool is_called_2 = false;
- auto subscription_2 = web_state_->AddScriptCommandCallback(
- base::BindRepeating(&HandleScriptCommand, &is_called_2, &value_2, kUrl2,
- /*expected_user_is_interacting*/ false, &main_frame),
- kPrefix2);
+ base::CallbackListSubscription subscription_2 =
+ web_state_->AddScriptCommandCallback(
+ base::BindRepeating(
+ &HandleScriptCommand, &is_called_2, &value_2, kUrl2,
+ /*expected_user_is_interacting*/ false, &main_frame),
+ kPrefix2);
const std::string kPrefix3("prefix3");
const std::string kCommand3("prefix3.command3");
@@ -840,10 +844,12 @@
const GURL kUrl3("http://iframe");
bool is_called_3 = false;
web::FakeChildWebFrame subframe(GURL::EmptyGURL());
- auto subscription_3 = web_state_->AddScriptCommandCallback(
- base::BindRepeating(&HandleScriptCommand, &is_called_3, &value_3, kUrl3,
- /*expected_user_is_interacting*/ false, &subframe),
- kPrefix3);
+ base::CallbackListSubscription subscription_3 =
+ web_state_->AddScriptCommandCallback(
+ base::BindRepeating(
+ &HandleScriptCommand, &is_called_3, &value_3, kUrl3,
+ /*expected_user_is_interacting*/ false, &subframe),
+ kPrefix3);
// Check that a irrelevant or invalid command does not trigger the callbacks.
web_state_->OnScriptCommandReceived("wohoo.blah", value_1, kUrl1,
@@ -882,7 +888,7 @@
is_called_3 = false;
// Remove the callback and check it is no longer called.
- subscription_1.reset();
+ subscription_1 = {};
web_state_->OnScriptCommandReceived(kCommand1, value_1, kUrl1,
/*user_is_interacting*/ false,
/*sender_frame*/ &main_frame);
diff --git a/ios/web/webui/web_ui_ios_impl.h b/ios/web/webui/web_ui_ios_impl.h
index 48d8bac..f0c7d15ae 100644
--- a/ios/web/webui/web_ui_ios_impl.h
+++ b/ios/web/webui/web_ui_ios_impl.h
@@ -67,7 +67,7 @@
std::vector<std::unique_ptr<WebUIIOSMessageHandler>> handlers_;
// Subscription for JS message.
- std::unique_ptr<web::WebState::ScriptCommandSubscription> subscription_;
+ base::CallbackListSubscription subscription_;
// Non-owning pointer to the WebState this WebUIIOS is associated with.
WebState* web_state_;
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm
index 5ade20e..9d72fe2 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -123,10 +123,9 @@
std::unique_ptr<ios_web_view::WebViewJavaScriptDialogPresenter>
_javaScriptDialogPresenter;
// Stores the script command callbacks with subscriptions.
- std::unordered_map<
- std::string,
- std::pair<web::WebState::ScriptCommandCallback,
- std::unique_ptr<web::WebState::ScriptCommandSubscription>>>
+ std::unordered_map<std::string,
+ std::pair<web::WebState::ScriptCommandCallback,
+ base::CallbackListSubscription>>
_scriptCommandCallbacks;
CRWSessionStorage* _cachedSessionStorage;
}
diff --git a/mojo/public/cpp/bindings/sync_handle_registry.h b/mojo/public/cpp/bindings/sync_handle_registry.h
index 9b4a7126..69ab2d9 100644
--- a/mojo/public/cpp/bindings/sync_handle_registry.h
+++ b/mojo/public/cpp/bindings/sync_handle_registry.h
@@ -44,7 +44,7 @@
private:
base::ScopedClosureRunner remove_runner_;
- std::unique_ptr<EventCallbackList::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
};
using EventCallbackSubscription = std::unique_ptr<Subscription>;
diff --git a/net/cert/internal/trust_store_mac.cc b/net/cert/internal/trust_store_mac.cc
index dacb4050..7bd9235 100644
--- a/net/cert/internal/trust_store_mac.cc
+++ b/net/cert/internal/trust_store_mac.cc
@@ -353,9 +353,9 @@
public:
// Registers |callback| to be run when the keychain trust settings change.
// Must be called on the network notification thread. |callback| will be run
- // on the network notification thread. The returned Subscription must be
+ // on the network notification thread. The returned subscription must be
// destroyed on the network notification thread.
- static std::unique_ptr<base::RepeatingClosureList::Subscription> AddCallback(
+ static base::CallbackListSubscription AddCallback(
base::RepeatingClosure callback) {
DCHECK(GetNetworkNotificationThreadMac()->RunsTasksInCurrentSequence());
return Get()->callback_list_.Add(std::move(callback));
@@ -427,7 +427,7 @@
void Increment() { base::subtle::Barrier_AtomicIncrement(&iteration_, 1); }
// Only accessed on the notification thread.
- std::unique_ptr<base::RepeatingClosureList::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
base::subtle::Atomic64 iteration_ = 0;
diff --git a/remoting/ios/app/remoting_view_controller.mm b/remoting/ios/app/remoting_view_controller.mm
index a62bdc2..3a0e846 100644
--- a/remoting/ios/app/remoting_view_controller.mm
+++ b/remoting/ios/app/remoting_view_controller.mm
@@ -95,10 +95,8 @@
HostFetchingErrorViewController* _fetchingErrorViewController;
HostSetupViewController* _setupViewController;
HostListService* _hostListService;
- std::unique_ptr<HostListService::CallbackSubscription>
- _hostListStateSubscription;
- std::unique_ptr<HostListService::CallbackSubscription>
- _hostListFetchFailureSubscription;
+ base::CallbackListSubscription _hostListStateSubscription;
+ base::CallbackListSubscription _hostListFetchFailureSubscription;
NSArray<id<RemotingRefreshControl>>* _refreshControls;
}
diff --git a/remoting/ios/facade/host_list_service.h b/remoting/ios/facade/host_list_service.h
index a951cebf..395a33b 100644
--- a/remoting/ios/facade/host_list_service.h
+++ b/remoting/ios/facade/host_list_service.h
@@ -46,19 +46,17 @@
std::string localized_description;
};
- using CallbackSubscription = base::RepeatingClosureList::Subscription;
-
// Returns the singleton instance.
static HostListService* GetInstance();
~HostListService();
// Registers callback to be called when the host list state is changed.
- std::unique_ptr<CallbackSubscription> RegisterHostListStateCallback(
+ base::CallbackListSubscription RegisterHostListStateCallback(
const base::RepeatingClosure& callback);
// Registers callback to be called when the host list has failed to fetch.
- std::unique_ptr<CallbackSubscription> RegisterFetchFailureCallback(
+ base::CallbackListSubscription RegisterFetchFailureCallback(
const base::RepeatingClosure& callback);
// Start a request to fetch the host list. Calls either the host list state
diff --git a/remoting/ios/facade/host_list_service.mm b/remoting/ios/facade/host_list_service.mm
index 3db26d9..a728840a 100644
--- a/remoting/ios/facade/host_list_service.mm
+++ b/remoting/ios/facade/host_list_service.mm
@@ -96,14 +96,12 @@
}];
}
-std::unique_ptr<HostListService::CallbackSubscription>
-HostListService::RegisterHostListStateCallback(
+base::CallbackListSubscription HostListService::RegisterHostListStateCallback(
const base::RepeatingClosure& callback) {
return host_list_state_callbacks_.Add(callback);
}
-std::unique_ptr<HostListService::CallbackSubscription>
-HostListService::RegisterFetchFailureCallback(
+base::CallbackListSubscription HostListService::RegisterFetchFailureCallback(
const base::RepeatingClosure& callback) {
return fetch_failure_callbacks_.Add(callback);
}
diff --git a/remoting/ios/facade/host_list_service_unittest.mm b/remoting/ios/facade/host_list_service_unittest.mm
index f5311b9..d8304324 100644
--- a/remoting/ios/facade/host_list_service_unittest.mm
+++ b/remoting/ios/facade/host_list_service_unittest.mm
@@ -81,10 +81,8 @@
id remoting_service_mock_;
private:
- std::unique_ptr<HostListService::CallbackSubscription>
- host_list_state_subscription_;
- std::unique_ptr<HostListService::CallbackSubscription>
- fetch_failure_subscription_;
+ base::CallbackListSubscription host_list_state_subscription_;
+ base::CallbackListSubscription fetch_failure_subscription_;
};
HostListServiceTest::HostListServiceTest()
diff --git a/remoting/signaling/ftl_messaging_client.cc b/remoting/signaling/ftl_messaging_client.cc
index 3c8b768..4168f4c 100644
--- a/remoting/signaling/ftl_messaging_client.cc
+++ b/remoting/signaling/ftl_messaging_client.cc
@@ -151,8 +151,8 @@
FtlMessagingClient::~FtlMessagingClient() = default;
-std::unique_ptr<FtlMessagingClient::MessageCallbackSubscription>
-FtlMessagingClient::RegisterMessageCallback(const MessageCallback& callback) {
+base::CallbackListSubscription FtlMessagingClient::RegisterMessageCallback(
+ const MessageCallback& callback) {
return callback_list_.Add(callback);
}
diff --git a/remoting/signaling/ftl_messaging_client.h b/remoting/signaling/ftl_messaging_client.h
index 4a6555d..8879fab 100644
--- a/remoting/signaling/ftl_messaging_client.h
+++ b/remoting/signaling/ftl_messaging_client.h
@@ -49,7 +49,7 @@
~FtlMessagingClient() override;
// MessagingClient implementations.
- std::unique_ptr<MessageCallbackSubscription> RegisterMessageCallback(
+ base::CallbackListSubscription RegisterMessageCallback(
const MessageCallback& callback) override;
void PullMessages(DoneCallback on_done) override;
void SendMessage(const std::string& destination,
diff --git a/remoting/signaling/ftl_signal_strategy.cc b/remoting/signaling/ftl_signal_strategy.cc
index c9dd9c1..f4d131a 100644
--- a/remoting/signaling/ftl_signal_strategy.cc
+++ b/remoting/signaling/ftl_signal_strategy.cc
@@ -82,8 +82,7 @@
std::string user_email_;
SignalingAddress local_address_;
- std::unique_ptr<MessagingClient::MessageCallbackSubscription>
- receive_message_subscription_;
+ base::CallbackListSubscription receive_message_subscription_;
Error error_ = OK;
bool is_sign_in_error_ = false;
@@ -143,7 +142,7 @@
if (receive_message_subscription_) {
local_address_ = SignalingAddress();
- receive_message_subscription_.reset();
+ receive_message_subscription_ = {};
messaging_client_->StopReceivingMessages();
for (auto& observer : listeners_)
diff --git a/remoting/signaling/ftl_signal_strategy_unittest.cc b/remoting/signaling/ftl_signal_strategy_unittest.cc
index 37500d0..da12e7a 100644
--- a/remoting/signaling/ftl_signal_strategy_unittest.cc
+++ b/remoting/signaling/ftl_signal_strategy_unittest.cc
@@ -78,7 +78,7 @@
class FakeMessagingClient : public MessagingClient {
public:
- std::unique_ptr<MessageCallbackSubscription> RegisterMessageCallback(
+ base::CallbackListSubscription RegisterMessageCallback(
const MessageCallback& callback) override {
return callback_list_.Add(callback);
}
diff --git a/remoting/signaling/messaging_client.h b/remoting/signaling/messaging_client.h
index 143ffa13d..3f26fdd 100644
--- a/remoting/signaling/messaging_client.h
+++ b/remoting/signaling/messaging_client.h
@@ -26,16 +26,15 @@
const ftl::ChromotingMessage& message)>;
using MessageCallbackList = base::CallbackList<
void(const ftl::Id&, const std::string&, const ftl::ChromotingMessage&)>;
- using MessageCallbackSubscription = MessageCallbackList::Subscription;
using DoneCallback =
base::OnceCallback<void(const ProtobufHttpStatus& status)>;
virtual ~MessagingClient() = default;
- // Registers a callback which is run for each new message received.
- // Simply delete the returned subscription object to unregister. The
- // subscription object must be deleted before |this| is deleted.
- virtual std::unique_ptr<MessageCallbackSubscription> RegisterMessageCallback(
+ // Registers a callback which is run for each new message received. Simply
+ // delete the returned subscription object to unregister. The subscription
+ // object must be deleted before |this| is deleted.
+ virtual base::CallbackListSubscription RegisterMessageCallback(
const MessageCallback& callback) = 0;
// Retrieves messages from the user's inbox over slow path and calls the
diff --git a/remoting/test/ftl_services_playground.cc b/remoting/test/ftl_services_playground.cc
index 2c4bb51..4a5547ed 100644
--- a/remoting/test/ftl_services_playground.cc
+++ b/remoting/test/ftl_services_playground.cc
@@ -117,7 +117,7 @@
token_getter_.get(), url_loader_factory_owner_->GetURLLoaderFactory(),
std::make_unique<test::TestDeviceIdProvider>(storage_.get()));
- message_subscription_.reset();
+ message_subscription_ = {};
messaging_client_ = std::make_unique<FtlMessagingClient>(
token_getter_.get(), url_loader_factory_owner_->GetURLLoaderFactory(),
registration_manager_.get());
diff --git a/remoting/test/ftl_services_playground.h b/remoting/test/ftl_services_playground.h
index 3bb586de..db8bd315 100644
--- a/remoting/test/ftl_services_playground.h
+++ b/remoting/test/ftl_services_playground.h
@@ -75,8 +75,7 @@
// Subscription must be deleted before |messaging_client_|.
std::unique_ptr<FtlMessagingClient> messaging_client_;
- std::unique_ptr<FtlMessagingClient::MessageCallbackSubscription>
- message_subscription_;
+ base::CallbackListSubscription message_subscription_;
base::OnceClosure receive_messages_done_callback_;
diff --git a/services/device/battery/battery_monitor_impl.h b/services/device/battery/battery_monitor_impl.h
index b5b17776..1ec2624e 100644
--- a/services/device/battery/battery_monitor_impl.h
+++ b/services/device/battery/battery_monitor_impl.h
@@ -31,8 +31,7 @@
void ReportStatus();
mojo::SelfOwnedReceiverRef<mojom::BatteryMonitor> receiver_;
- std::unique_ptr<BatteryStatusService::BatteryUpdateSubscription>
- subscription_;
+ base::CallbackListSubscription subscription_;
QueryNextStatusCallback callback_;
mojom::BatteryStatus status_;
bool status_to_report_;
diff --git a/services/device/battery/battery_status_service.cc b/services/device/battery/battery_status_service.cc
index 67f6c9f..7dd592e50 100644
--- a/services/device/battery/battery_status_service.cc
+++ b/services/device/battery/battery_status_service.cc
@@ -35,8 +35,8 @@
return service_wrapper.get();
}
-std::unique_ptr<BatteryStatusService::BatteryUpdateSubscription>
-BatteryStatusService::AddCallback(const BatteryUpdateCallback& callback) {
+base::CallbackListSubscription BatteryStatusService::AddCallback(
+ const BatteryUpdateCallback& callback) {
DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
DCHECK(!is_shutdown_);
diff --git a/services/device/battery/battery_status_service.h b/services/device/battery/battery_status_service.h
index 619e256..e59b050 100644
--- a/services/device/battery/battery_status_service.h
+++ b/services/device/battery/battery_status_service.h
@@ -24,7 +24,6 @@
BatteryUpdateCallback;
typedef base::CallbackList<void(const mojom::BatteryStatus&)>
BatteryUpdateCallbackList;
- typedef BatteryUpdateCallbackList::Subscription BatteryUpdateSubscription;
// Returns the BatteryStatusService singleton.
static BatteryStatusService* GetInstance();
@@ -38,7 +37,7 @@
// Adds a callback to receive battery status updates. Must be called on the
// main thread. The callback itself will be called on the main thread as well.
// NOTE: The callback may be run before AddCallback returns!
- std::unique_ptr<BatteryUpdateSubscription> AddCallback(
+ base::CallbackListSubscription AddCallback(
const BatteryUpdateCallback& callback);
// Gracefully clean-up.
diff --git a/services/device/battery/battery_status_service_unittest.cc b/services/device/battery/battery_status_service_unittest.cc
index 67fcdbb0..b3c946d 100644
--- a/services/device/battery/battery_status_service_unittest.cc
+++ b/services/device/battery/battery_status_service_unittest.cc
@@ -59,8 +59,6 @@
~BatteryStatusServiceTest() override {}
protected:
- typedef BatteryStatusService::BatteryUpdateSubscription BatterySubscription;
-
void SetUp() override {
callback1_ = base::BindRepeating(&BatteryStatusServiceTest::Callback1,
base::Unretained(this));
@@ -80,7 +78,7 @@
FakeBatteryManager* battery_manager() { return battery_manager_; }
- std::unique_ptr<BatterySubscription> AddCallback(
+ base::CallbackListSubscription AddCallback(
const BatteryStatusService::BatteryUpdateCallback& callback) {
return battery_service_.AddCallback(callback);
}
@@ -123,30 +121,30 @@
};
TEST_F(BatteryStatusServiceTest, AddFirstCallback) {
- std::unique_ptr<BatterySubscription> subscription1 = AddCallback(callback1());
+ base::CallbackListSubscription subscription1 = AddCallback(callback1());
EXPECT_EQ(1, battery_manager()->start_invoked_count());
EXPECT_EQ(0, battery_manager()->stop_invoked_count());
- subscription1.reset();
+ subscription1 = {};
EXPECT_EQ(1, battery_manager()->start_invoked_count());
EXPECT_EQ(1, battery_manager()->stop_invoked_count());
}
TEST_F(BatteryStatusServiceTest, AddCallbackAfterUpdate) {
- std::unique_ptr<BatterySubscription> subscription1 = AddCallback(callback1());
+ base::CallbackListSubscription subscription1 = AddCallback(callback1());
mojom::BatteryStatus status;
battery_manager()->InvokeUpdateCallback(status);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, callback1_invoked_count());
EXPECT_EQ(0, callback2_invoked_count());
- std::unique_ptr<BatterySubscription> subscription2 = AddCallback(callback2());
+ base::CallbackListSubscription subscription2 = AddCallback(callback2());
EXPECT_EQ(1, callback1_invoked_count());
EXPECT_EQ(1, callback2_invoked_count());
}
TEST_F(BatteryStatusServiceTest, TwoCallbacksUpdate) {
- std::unique_ptr<BatterySubscription> subscription1 = AddCallback(callback1());
- std::unique_ptr<BatterySubscription> subscription2 = AddCallback(callback2());
+ base::CallbackListSubscription subscription1 = AddCallback(callback1());
+ base::CallbackListSubscription subscription2 = AddCallback(callback2());
mojom::BatteryStatus status;
status.charging = true;
@@ -165,8 +163,8 @@
}
TEST_F(BatteryStatusServiceTest, RemoveOneCallback) {
- std::unique_ptr<BatterySubscription> subscription1 = AddCallback(callback1());
- std::unique_ptr<BatterySubscription> subscription2 = AddCallback(callback2());
+ base::CallbackListSubscription subscription1 = AddCallback(callback1());
+ base::CallbackListSubscription subscription2 = AddCallback(callback2());
mojom::BatteryStatus status;
battery_manager()->InvokeUpdateCallback(status);
@@ -174,7 +172,7 @@
EXPECT_EQ(1, callback1_invoked_count());
EXPECT_EQ(1, callback2_invoked_count());
- subscription1.reset();
+ subscription1 = {};
battery_manager()->InvokeUpdateCallback(status);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, callback1_invoked_count());
diff --git a/services/device/geolocation/geolocation_impl.cc b/services/device/geolocation/geolocation_impl.cc
index 85509b1..28b0994 100644
--- a/services/device/geolocation/geolocation_impl.cc
+++ b/services/device/geolocation/geolocation_impl.cc
@@ -83,7 +83,7 @@
}
void GeolocationImpl::PauseUpdates() {
- geolocation_subscription_.reset();
+ geolocation_subscription_ = {};
}
void GeolocationImpl::ResumeUpdates() {
@@ -134,7 +134,7 @@
if (!ValidateGeoposition(position_override_))
ResumeUpdates();
- geolocation_subscription_.reset();
+ geolocation_subscription_ = {};
OnLocationUpdate(position_override_);
}
diff --git a/services/device/geolocation/geolocation_impl.h b/services/device/geolocation/geolocation_impl.h
index e19e504b..28eddf9 100644
--- a/services/device/geolocation/geolocation_impl.h
+++ b/services/device/geolocation/geolocation_impl.h
@@ -53,7 +53,7 @@
GeolocationContext* context_;
// Token that unsubscribes from GeolocationProvider updates when destroyed.
- std::unique_ptr<GeolocationProvider::Subscription> geolocation_subscription_;
+ base::CallbackListSubscription geolocation_subscription_;
// The callback passed to QueryNextPosition.
QueryNextPositionCallback position_callback_;
diff --git a/services/device/geolocation/geolocation_provider.h b/services/device/geolocation/geolocation_provider.h
index 26596a1..d49d699 100644
--- a/services/device/geolocation/geolocation_provider.h
+++ b/services/device/geolocation/geolocation_provider.h
@@ -16,7 +16,7 @@
// a single instance of this class and can register multiple clients to be
// notified of location changes:
// * Callbacks are registered by AddLocationUpdateCallback() and will keep
-// receiving updates until the returned subscription object is destructed.
+// receiving updates until the returned subscription object is destroyed.
// The application must instantiate the GeolocationProvider on the UI thread and
// must communicate with it on the same thread.
// The underlying location arbitrator will only be enabled whilst there is at
@@ -34,13 +34,11 @@
typedef base::RepeatingCallback<void(const mojom::Geoposition&)>
LocationUpdateCallback;
- typedef base::CallbackList<void(const mojom::Geoposition&)>::Subscription
- Subscription;
// |enable_high_accuracy| is used as a 'hint' for the provider preferences for
// this particular observer, however the observer could receive updates for
// best available locations from any active provider whilst it is registered.
- virtual std::unique_ptr<Subscription> AddLocationUpdateCallback(
+ virtual base::CallbackListSubscription AddLocationUpdateCallback(
const LocationUpdateCallback& callback,
bool enable_high_accuracy) = 0;
diff --git a/services/device/geolocation/geolocation_provider_impl.cc b/services/device/geolocation/geolocation_provider_impl.cc
index 3eb6f681..1a57452 100644
--- a/services/device/geolocation/geolocation_provider_impl.cc
+++ b/services/device/geolocation/geolocation_provider_impl.cc
@@ -64,12 +64,12 @@
}
}
-std::unique_ptr<GeolocationProvider::Subscription>
+base::CallbackListSubscription
GeolocationProviderImpl::AddLocationUpdateCallback(
const LocationUpdateCallback& callback,
bool enable_high_accuracy) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
- std::unique_ptr<GeolocationProvider::Subscription> subscription;
+ base::CallbackListSubscription subscription;
if (enable_high_accuracy) {
subscription = high_accuracy_callbacks_.Add(callback);
} else {
diff --git a/services/device/geolocation/geolocation_provider_impl.h b/services/device/geolocation/geolocation_provider_impl.h
index baf8925f..04d475a 100644
--- a/services/device/geolocation/geolocation_provider_impl.h
+++ b/services/device/geolocation/geolocation_provider_impl.h
@@ -44,7 +44,7 @@
public base::Thread {
public:
// GeolocationProvider implementation:
- std::unique_ptr<GeolocationProvider::Subscription> AddLocationUpdateCallback(
+ base::CallbackListSubscription AddLocationUpdateCallback(
const LocationUpdateCallback& callback,
bool enable_high_accuracy) override;
bool HighAccuracyLocationInUse() override;
diff --git a/services/device/geolocation/geolocation_provider_impl_unittest.cc b/services/device/geolocation/geolocation_provider_impl_unittest.cc
index e085cb2..ff22384 100644
--- a/services/device/geolocation/geolocation_provider_impl_unittest.cc
+++ b/services/device/geolocation/geolocation_provider_impl_unittest.cc
@@ -183,13 +183,13 @@
TEST_F(GeolocationProviderTest, StartStop) {
EXPECT_FALSE(provider()->IsRunning());
- std::unique_ptr<GeolocationProvider::Subscription> subscription =
+ base::CallbackListSubscription subscription =
provider()->AddLocationUpdateCallback(
base::BindRepeating(&DummyFunction, arbitrator()), false);
EXPECT_TRUE(provider()->IsRunning());
EXPECT_TRUE(ProvidersStarted());
- subscription.reset();
+ subscription = {};
EXPECT_FALSE(ProvidersStarted());
EXPECT_TRUE(provider()->IsRunning());
@@ -207,12 +207,12 @@
base::BindRepeating(&MockGeolocationObserver::OnLocationUpdate,
base::Unretained(&first_observer));
EXPECT_CALL(first_observer, OnLocationUpdate(GeopositionEq(first_position)));
- std::unique_ptr<GeolocationProvider::Subscription> subscription =
+ base::CallbackListSubscription subscription =
provider()->AddLocationUpdateCallback(first_callback, false);
SendMockLocation(first_position);
base::RunLoop().Run();
- subscription.reset();
+ subscription = {};
mojom::Geoposition second_position;
second_position.latitude = 13;
@@ -228,7 +228,7 @@
GeolocationProviderImpl::LocationUpdateCallback second_callback =
base::BindRepeating(&MockGeolocationObserver::OnLocationUpdate,
base::Unretained(&second_observer));
- std::unique_ptr<GeolocationProvider::Subscription> subscription2 =
+ base::CallbackListSubscription subscription2 =
provider()->AddLocationUpdateCallback(second_callback, false);
base::RunLoop().RunUntilIdle();
@@ -238,7 +238,7 @@
SendMockLocation(second_position);
base::RunLoop().Run();
- subscription2.reset();
+ subscription2 = {};
EXPECT_FALSE(ProvidersStarted());
}
@@ -253,9 +253,9 @@
GeolocationProviderImpl::LocationUpdateCallback callback =
base::BindRepeating(&MockGeolocationObserver::OnLocationUpdate,
base::Unretained(&mock_observer));
- std::unique_ptr<GeolocationProvider::Subscription> subscription =
+ base::CallbackListSubscription subscription =
provider()->AddLocationUpdateCallback(callback, false);
- subscription.reset();
+ subscription = {};
// Wait for the providers to be stopped now that all clients are gone.
EXPECT_FALSE(ProvidersStarted());
}
diff --git a/ui/base/pointer/touch_ui_controller.cc b/ui/base/pointer/touch_ui_controller.cc
index d91151b4..8c325d9b 100644
--- a/ui/base/pointer/touch_ui_controller.cc
+++ b/ui/base/pointer/touch_ui_controller.cc
@@ -105,8 +105,8 @@
TouchUiChanged();
}
-std::unique_ptr<TouchUiController::Subscription>
-TouchUiController::RegisterCallback(const base::RepeatingClosure& closure) {
+base::CallbackListSubscription TouchUiController::RegisterCallback(
+ const base::RepeatingClosure& closure) {
return callback_list_.Add(closure);
}
diff --git a/ui/base/pointer/touch_ui_controller.h b/ui/base/pointer/touch_ui_controller.h
index bcd93ac6..441bfe51 100644
--- a/ui/base/pointer/touch_ui_controller.h
+++ b/ui/base/pointer/touch_ui_controller.h
@@ -24,7 +24,6 @@
class COMPONENT_EXPORT(UI_BASE) TouchUiController {
public:
using CallbackList = base::RepeatingClosureList;
- using Subscription = CallbackList::Subscription;
enum class TouchUiState {
kDisabled,
@@ -62,7 +61,7 @@
((touch_ui_state_ == TouchUiState::kAuto) && tablet_mode_);
}
- std::unique_ptr<Subscription> RegisterCallback(
+ base::CallbackListSubscription RegisterCallback(
const base::RepeatingClosure& closure);
void OnTabletModeToggled(bool enabled);
diff --git a/ui/base/pointer/touch_ui_controller_unittest.cc b/ui/base/pointer/touch_ui_controller_unittest.cc
index 98d7baa..dce35e3 100644
--- a/ui/base/pointer/touch_ui_controller_unittest.cc
+++ b/ui/base/pointer/touch_ui_controller_unittest.cc
@@ -25,7 +25,7 @@
private:
int touch_ui_changes_ = 0;
- std::unique_ptr<ui::TouchUiController::Subscription> subscription_;
+ base::CallbackListSubscription subscription_;
};
} // namespace
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index 6b66522..23d77f8 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -182,7 +182,7 @@
return ink_drop_ && ink_drop_->IsHighlightFadingInOrVisible();
}
-PropertyChangedSubscription InkDropHostView::AddHighlightedChangedCallback(
+base::CallbackListSubscription InkDropHostView::AddHighlightedChangedCallback(
PropertyChangedCallback callback) {
// Since the highlight state is not directly represented by a member, use the
// applicable member (|ink_drop_|) as the property key. Note that this won't
diff --git a/ui/views/animation/ink_drop_host_view.h b/ui/views/animation/ink_drop_host_view.h
index ce6581c..8c8f77f 100644
--- a/ui/views/animation/ink_drop_host_view.h
+++ b/ui/views/animation/ink_drop_host_view.h
@@ -135,7 +135,7 @@
// animating into "highlight visible" steady state).
bool GetHighlighted() const;
- PropertyChangedSubscription AddHighlightedChangedCallback(
+ base::CallbackListSubscription AddHighlightedChangedCallback(
PropertyChangedCallback callback);
// Should be called by InkDrop implementations when their highlight state
diff --git a/ui/views/animation/installable_ink_drop.cc b/ui/views/animation/installable_ink_drop.cc
index 2701886..dd71277c 100644
--- a/ui/views/animation/installable_ink_drop.cc
+++ b/ui/views/animation/installable_ink_drop.cc
@@ -109,7 +109,7 @@
SchedulePaint();
}
-std::unique_ptr<base::RepeatingClosureList::Subscription>
+base::CallbackListSubscription
InstallableInkDrop::RegisterHighlightedChangedCallback(
base::RepeatingClosure callback) {
return highlighted_changed_list_.Add(std::move(callback));
diff --git a/ui/views/animation/installable_ink_drop.h b/ui/views/animation/installable_ink_drop.h
index c46a392..1b91ea19 100644
--- a/ui/views/animation/installable_ink_drop.h
+++ b/ui/views/animation/installable_ink_drop.h
@@ -63,8 +63,8 @@
InstallableInkDropConfig config() const { return config_; }
// Registers |callback| to be called whenever the highlighted state changes.
- std::unique_ptr<base::RepeatingClosureList::Subscription>
- RegisterHighlightedChangedCallback(base::RepeatingClosure callback);
+ base::CallbackListSubscription RegisterHighlightedChangedCallback(
+ base::RepeatingClosure callback);
// Should only be used for inspecting properties of the layer in tests.
const ui::Layer* layer_for_testing() const { return layer_.get(); }
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.h b/ui/views/bubble/bubble_dialog_delegate_view.h
index c88970286..2f2b186 100644
--- a/ui/views/bubble/bubble_dialog_delegate_view.h
+++ b/ui/views/bubble/bubble_dialog_delegate_view.h
@@ -341,8 +341,7 @@
std::unique_ptr<AnchorViewObserver> anchor_view_observer_;
std::unique_ptr<AnchorWidgetObserver> anchor_widget_observer_;
std::unique_ptr<BubbleWidgetObserver> bubble_widget_observer_;
- std::unique_ptr<Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_;
+ base::CallbackListSubscription paint_as_active_subscription_;
std::unique_ptr<Widget::PaintAsActiveLock> paint_as_active_lock_;
bool adjust_if_offscreen_ = true;
bool focus_traversable_from_anchor_view_ = true;
diff --git a/ui/views/bubble/bubble_dialog_model_host.h b/ui/views/bubble/bubble_dialog_model_host.h
index 5dd3e94..78e870c 100644
--- a/ui/views/bubble/bubble_dialog_model_host.h
+++ b/ui/views/bubble/bubble_dialog_model_host.h
@@ -132,7 +132,7 @@
std::unique_ptr<ui::DialogModel> model_;
std::vector<DialogModelHostField> fields_;
- std::vector<PropertyChangedSubscription> property_changed_subscriptions_;
+ std::vector<base::CallbackListSubscription> property_changed_subscriptions_;
LayoutConsensusGroup textfield_first_column_group_;
LayoutConsensusGroup textfield_second_column_group_;
diff --git a/ui/views/controls/button/button.cc b/ui/views/controls/button/button.cc
index e1f389d..c3c3e7c 100644
--- a/ui/views/controls/button/button.cc
+++ b/ui/views/controls/button/button.cc
@@ -347,7 +347,7 @@
nullptr);
}
-PropertyChangedSubscription Button::AddStateChangedCallback(
+base::CallbackListSubscription Button::AddStateChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&state_, std::move(callback));
}
diff --git a/ui/views/controls/button/button.h b/ui/views/controls/button/button.h
index d2ae906..6e059dc 100644
--- a/ui/views/controls/button/button.h
+++ b/ui/views/controls/button/button.h
@@ -182,7 +182,7 @@
// Highlights the ink drop for the button.
void SetHighlighted(bool bubble_visible);
- PropertyChangedSubscription AddStateChangedCallback(
+ base::CallbackListSubscription AddStateChangedCallback(
PropertyChangedCallback callback);
// Overridden from View:
@@ -355,7 +355,7 @@
// ButtonController.
std::unique_ptr<ButtonController> button_controller_;
- PropertyChangedSubscription enabled_changed_subscription_{
+ base::CallbackListSubscription enabled_changed_subscription_{
AddEnabledChangedCallback(base::BindRepeating(&Button::OnEnabledChanged,
base::Unretained(this)))};
diff --git a/ui/views/controls/button/button_unittest.cc b/ui/views/controls/button/button_unittest.cc
index 89556955..74cce33 100644
--- a/ui/views/controls/button/button_unittest.cc
+++ b/ui/views/controls/button/button_unittest.cc
@@ -155,8 +155,8 @@
bool highlighted_changed_ = false;
bool state_changed_ = false;
- PropertyChangedSubscription highlighted_changed_subscription_;
- PropertyChangedSubscription state_changed_subscription_;
+ base::CallbackListSubscription highlighted_changed_subscription_;
+ base::CallbackListSubscription state_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(TestButtonObserver);
};
diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc
index a0c317ab..3b67a43 100644
--- a/ui/views/controls/button/checkbox.cc
+++ b/ui/views/controls/button/checkbox.cc
@@ -83,7 +83,7 @@
return checked_;
}
-PropertyChangedSubscription Checkbox::AddCheckedChangedCallback(
+base::CallbackListSubscription Checkbox::AddCheckedChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&checked_, callback);
}
diff --git a/ui/views/controls/button/checkbox.h b/ui/views/controls/button/checkbox.h
index 86cc2f1..57fcacd 100644
--- a/ui/views/controls/button/checkbox.h
+++ b/ui/views/controls/button/checkbox.h
@@ -36,7 +36,7 @@
virtual void SetChecked(bool checked);
bool GetChecked() const;
- PropertyChangedSubscription AddCheckedChangedCallback(
+ base::CallbackListSubscription AddCheckedChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
void SetMultiLine(bool multi_line);
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 563bc70f4..66447b2 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -476,7 +476,7 @@
}
void LabelButton::RemovedFromWidget() {
- paint_as_active_subscription_.reset();
+ paint_as_active_subscription_ = {};
}
void LabelButton::OnFocus() {
diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h
index 5dbf8e3..39887eb 100644
--- a/ui/views/controls/button/label_button.h
+++ b/ui/views/controls/button/label_button.h
@@ -263,10 +263,9 @@
// UI direction).
gfx::HorizontalAlignment horizontal_alignment_ = gfx::ALIGN_LEFT;
- std::unique_ptr<Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_;
+ base::CallbackListSubscription paint_as_active_subscription_;
- PropertyChangedSubscription flip_canvas_on_paint_subscription_ =
+ base::CallbackListSubscription flip_canvas_on_paint_subscription_ =
AddFlipCanvasOnPaintForRTLUIChangedCallback(
base::BindRepeating(&LabelButton::FlipCanvasOnPaintForRTLUIChanged,
base::Unretained(this)));
diff --git a/ui/views/controls/button/label_button_label.h b/ui/views/controls/button/label_button_label.h
index 88ab371..6bcd913 100644
--- a/ui/views/controls/button/label_button_label.h
+++ b/ui/views/controls/button/label_button_label.h
@@ -42,7 +42,7 @@
base::Optional<SkColor> requested_disabled_color_;
base::Optional<SkColor> requested_enabled_color_;
- PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&LabelButtonLabel::OnEnabledChanged,
base::Unretained(this)));
diff --git a/ui/views/controls/button/menu_button_controller.cc b/ui/views/controls/button/menu_button_controller.cc
index f621f8b..27cb7dc 100644
--- a/ui/views/controls/button/menu_button_controller.cc
+++ b/ui/views/controls/button/menu_button_controller.cc
@@ -319,7 +319,7 @@
// If this was the last lock, manually reset state to the desired state.
if (pressed_lock_count_ == 0) {
menu_closed_time_ = TimeTicks::Now();
- state_changed_subscription_.reset();
+ state_changed_subscription_ = {};
LabelButton::ButtonState desired_state = Button::STATE_NORMAL;
if (should_disable_after_press_) {
desired_state = Button::STATE_DISABLED;
diff --git a/ui/views/controls/button/menu_button_controller.h b/ui/views/controls/button/menu_button_controller.h
index a7129e6..6c0afac 100644
--- a/ui/views/controls/button/menu_button_controller.h
+++ b/ui/views/controls/button/menu_button_controller.h
@@ -115,7 +115,7 @@
bool should_disable_after_press_ = false;
// Subscribes to state changes on the button while pressed lock is engaged.
- views::PropertyChangedSubscription state_changed_subscription_;
+ base::CallbackListSubscription state_changed_subscription_;
base::WeakPtrFactory<MenuButtonController> weak_factory_{this};
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 3ecf5ad..46894704 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -504,7 +504,7 @@
return substring_bounds;
}
-views::PropertyChangedSubscription Label::AddTextChangedCallback(
+base::CallbackListSubscription Label::AddTextChangedCallback(
views::PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&full_text_ + kLabelText,
std::move(callback));
diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h
index 0a6bac2..9f5953b 100644
--- a/ui/views/controls/label.h
+++ b/ui/views/controls/label.h
@@ -280,7 +280,7 @@
// within the |range|. See gfx::RenderText.
std::vector<gfx::Rect> GetSubstringBounds(const gfx::Range& range);
- views::PropertyChangedSubscription AddTextChangedCallback(
+ base::CallbackListSubscription AddTextChangedCallback(
views::PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// View:
diff --git a/ui/views/controls/link.h b/ui/views/controls/link.h
index 6db2cd4..0564896 100644
--- a/ui/views/controls/link.h
+++ b/ui/views/controls/link.h
@@ -96,7 +96,7 @@
// The color when the link is neither pressed nor disabled.
base::Optional<SkColor> requested_enabled_color_;
- PropertyChangedSubscription enabled_changed_subscription_;
+ base::CallbackListSubscription enabled_changed_subscription_;
// Whether the link text should use underline style regardless of enabled or
// focused state.
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
index 38bb7252..43b455d2 100644
--- a/ui/views/controls/menu/menu_item_view.cc
+++ b/ui/views/controls/menu/menu_item_view.cc
@@ -420,7 +420,7 @@
OnPropertyChanged(&selected_, kPropertyEffectsPaint);
}
-PropertyChangedSubscription MenuItemView::AddSelectedChangedCallback(
+base::CallbackListSubscription MenuItemView::AddSelectedChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&selected_, std::move(callback));
}
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h
index e0c4189..73b48ec 100644
--- a/ui/views/controls/menu/menu_item_view.h
+++ b/ui/views/controls/menu/menu_item_view.h
@@ -239,7 +239,7 @@
// Adds a callback subscription associated with the above selected property.
// The callback will be invoked whenever the selected property changes.
- PropertyChangedSubscription AddSelectedChangedCallback(
+ base::CallbackListSubscription AddSelectedChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// Sets whether the submenu area of an ACTIONABLE_SUBMENU is selected.
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index bdf4f61..dd71b2b 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -2194,7 +2194,7 @@
ShowVirtualKeyboardIfEnabled();
}
-views::PropertyChangedSubscription Textfield::AddTextChangedCallback(
+base::CallbackListSubscription Textfield::AddTextChangedCallback(
views::PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&model_ + kTextfieldText,
std::move(callback));
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index 46d553f..20f7cd7a 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -434,7 +434,7 @@
bool is_composition_committed) override;
#endif
- views::PropertyChangedSubscription AddTextChangedCallback(
+ base::CallbackListSubscription AddTextChangedCallback(
views::PropertyChangedCallback callback) WARN_UNUSED_RESULT;
protected:
@@ -736,7 +736,7 @@
gfx::Insets extra_insets_ = gfx::Insets();
// Holds the subscription object for the enabled changed callback.
- PropertyChangedSubscription enabled_changed_subscription_ =
+ base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&Textfield::OnEnabledChanged,
base::Unretained(this)));
diff --git a/ui/views/metadata/metadata_unittest.cc b/ui/views/metadata/metadata_unittest.cc
index 3366a46..a726aa17 100644
--- a/ui/views/metadata/metadata_unittest.cc
+++ b/ui/views/metadata/metadata_unittest.cc
@@ -55,7 +55,7 @@
OnPropertyChanged(&int_property_, views::kPropertyEffectsNone);
}
int GetIntProperty() const { return int_property_; }
- views::PropertyChangedSubscription AddIntPropertyChangedCallback(
+ base::CallbackListSubscription AddIntPropertyChangedCallback(
views::PropertyChangedCallback callback) WARN_UNUSED_RESULT {
return AddPropertyChangedCallback(&int_property_, std::move(callback));
}
@@ -84,7 +84,7 @@
OnPropertyChanged(&float_property_, views::kPropertyEffectsNone);
}
float GetFloatProperty() const { return float_property_; }
- views::PropertyChangedSubscription AddFloatPropertyChangedCallback(
+ base::CallbackListSubscription AddFloatPropertyChangedCallback(
views::PropertyChangedCallback callback) WARN_UNUSED_RESULT {
return AddPropertyChangedCallback(&float_property_, std::move(callback));
}
@@ -115,7 +115,7 @@
const float start_value = 12.34f;
MetadataTestView test_obj;
- views::PropertyChangedSubscription callback =
+ base::CallbackListSubscription callback =
test_obj.AddFloatPropertyChangedCallback(base::BindRepeating(
&MetadataTest::OnFloatPropertyChanged, base::Unretained(this)));
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 39e229e1..a7fecf7 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -546,7 +546,7 @@
}
}
-PropertyChangedSubscription View::AddVisibleChangedCallback(
+base::CallbackListSubscription View::AddVisibleChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&visible_, std::move(callback));
}
@@ -569,7 +569,7 @@
OnPropertyChanged(&enabled_, kPropertyEffectsPaint);
}
-PropertyChangedSubscription View::AddEnabledChangedCallback(
+base::CallbackListSubscription View::AddEnabledChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&enabled_, std::move(callback));
}
@@ -842,7 +842,7 @@
OnPropertyChanged(&id_, kPropertyEffectsNone);
}
-PropertyChangedSubscription View::AddIDChangedCallback(
+base::CallbackListSubscription View::AddIDChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&id_, callback);
}
@@ -860,7 +860,7 @@
return group_;
}
-PropertyChangedSubscription View::AddGroupChangedCallback(
+base::CallbackListSubscription View::AddGroupChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&group_, callback);
}
@@ -1167,7 +1167,8 @@
OnPropertyChanged(&flip_canvas_on_paint_for_rtl_ui_, kPropertyEffectsPaint);
}
-PropertyChangedSubscription View::AddFlipCanvasOnPaintForRTLUIChangedCallback(
+base::CallbackListSubscription
+View::AddFlipCanvasOnPaintForRTLUIChangedCallback(
PropertyChangedCallback callback) {
return AddPropertyChangedCallback(&flip_canvas_on_paint_for_rtl_ui_,
std::move(callback));
@@ -2177,7 +2178,7 @@
SchedulePaint();
}
-PropertyChangedSubscription View::AddPropertyChangedCallback(
+base::CallbackListSubscription View::AddPropertyChangedCallback(
PropertyKey property,
PropertyChangedCallback callback) {
auto entry = property_changed_vectors_.find(property);
diff --git a/ui/views/view.h b/ui/views/view.h
index 758e7d17..1b2daa3a 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -129,8 +129,6 @@
using PropertyChangedCallbacks = base::RepeatingClosureList;
using PropertyChangedCallback = PropertyChangedCallbacks::CallbackType;
-using PropertyChangedSubscription =
- std::unique_ptr<PropertyChangedCallbacks::Subscription>;
// The elements in PropertyEffects represent bits which define what effect(s) a
// changed Property has on the containing class. Additional elements should
@@ -202,7 +200,7 @@
// Each property should also have a way to "listen" to changes by registering
// a callback.
//
-// PropertyChangedSubscription AddFrobbleChangedCallback(
+// base::CallbackListSubscription AddFrobbleChangedCallback(
// PropertyChangedCallback callback) WARN_UNUSED_RETURN;
//
// Each callback uses the the existing base::Bind mechanisms which allow for
@@ -214,7 +212,7 @@
// ...
// private:
// void OnFrobbleChanged();
-// PropertyChangeSubscription frobble_changed_subscription_;
+// base::CallbackListSubscription frobble_changed_subscription_;
// }
//
// ...
@@ -226,7 +224,7 @@
//
// void MyView::ValidateFrobbleChanged() {
// bool frobble_changed = false;
-// PropertyChangedSubscription subscription =
+// base::CallbackListSubscription subscription =
// frobble_view_->AddFrobbleChangedCallback(
// base::BindRepeating([](bool* frobble_changed_ptr) {
// *frobble_changed_ptr = true;
@@ -573,9 +571,9 @@
// Return whether a view is visible.
bool GetVisible() const;
- // Adds a callback subscription associated with the above Visible property.
- // The callback will be invoked whenever the Visible property changes.
- PropertyChangedSubscription AddVisibleChangedCallback(
+ // Adds a callback associated with the above Visible property. The callback
+ // will be invoked whenever the Visible property changes.
+ base::CallbackListSubscription AddVisibleChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// Returns true if this view is drawn on screen.
@@ -591,9 +589,9 @@
// Returns whether the view is enabled.
bool GetEnabled() const;
- // Adds a callback subscription associated with the above |Enabled| property.
- // The callback will be invoked whenever the property changes.
- PropertyChangedSubscription AddEnabledChangedCallback(
+ // Adds a callback associated with the above |Enabled| property. The callback
+ // will be invoked whenever the property changes.
+ base::CallbackListSubscription AddEnabledChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// Returns the child views ordered in reverse z-order. That is, views later in
@@ -771,9 +769,9 @@
int GetID() const { return id_; }
void SetID(int id);
- // Adds a callback subscription associated with the above |ID| property.
- // The callback will be invoked whenever the property changes.
- PropertyChangedSubscription AddIDChangedCallback(
+ // Adds a callback associated with the above |ID| property. The callback will
+ // be invoked whenever the property changes.
+ base::CallbackListSubscription AddIDChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// A group id is used to tag views which are part of the same logical group.
@@ -784,9 +782,9 @@
// Returns the group id of the view, or -1 if the id is not set yet.
int GetGroup() const;
- // Adds a callback subscription associated with the above |Group| property.
- // The callback will be invoked whenever the property changes.
- PropertyChangedSubscription AddGroupChangedCallback(
+ // Adds a callback associated with the above |Group| property. The callback
+ // will be invoked whenever the property changes.
+ base::CallbackListSubscription AddGroupChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// If this returns true, the views from the same group can each be focused
@@ -913,10 +911,10 @@
// the UI directionality.
void SetFlipCanvasOnPaintForRTLUI(bool enable);
- // Adds a callback subscription associated with the above
- // FlipCanvasOnPaintForRTLUI property. The callback will be invoked whenever
- // the FlipCanvasOnPaintForRTLUI property changes.
- PropertyChangedSubscription AddFlipCanvasOnPaintForRTLUIChangedCallback(
+ // Adds a callback associated with the above FlipCanvasOnPaintForRTLUI
+ // property. The callback will be invoked whenever the
+ // FlipCanvasOnPaintForRTLUI property changes.
+ base::CallbackListSubscription AddFlipCanvasOnPaintForRTLUIChangedCallback(
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
// When set, this view will ignore base::l18n::IsRTL() and instead be drawn
@@ -1583,7 +1581,7 @@
// Property Support ----------------------------------------------------------
- PropertyChangedSubscription AddPropertyChangedCallback(
+ base::CallbackListSubscription AddPropertyChangedCallback(
PropertyKey property,
PropertyChangedCallback callback) WARN_UNUSED_RESULT;
void OnPropertyChanged(PropertyKey property,
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index c27777b..66fec64 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -1055,8 +1055,7 @@
return native_widget_->GetName();
}
-std::unique_ptr<Widget::PaintAsActiveCallbackList::Subscription>
-Widget::RegisterPaintAsActiveChangedCallback(
+base::CallbackListSubscription Widget::RegisterPaintAsActiveChangedCallback(
PaintAsActiveCallbackList::CallbackType callback) {
return paint_as_active_callbacks_.Add(std::move(callback));
}
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index 50f3fb1..819ea9a 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -932,8 +932,7 @@
// Registers |callback| to be called whenever the "paint as active" state
// changes.
- std::unique_ptr<PaintAsActiveCallbackList::Subscription>
- RegisterPaintAsActiveChangedCallback(
+ base::CallbackListSubscription RegisterPaintAsActiveChangedCallback(
PaintAsActiveCallbackList::CallbackType callback);
// Prevents the widget from being rendered as inactive during the lifetime of
diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h
index cb70272..d5e1adf1 100644
--- a/ui/views/window/custom_frame_view.h
+++ b/ui/views/window/custom_frame_view.h
@@ -156,11 +156,10 @@
int minimum_title_bar_x_ = 0;
int maximum_title_bar_x_ = -1;
- std::unique_ptr<Widget::PaintAsActiveCallbackList::Subscription>
- paint_as_active_subscription_ =
- frame_->RegisterPaintAsActiveChangedCallback(
- base::BindRepeating(&CustomFrameView::SchedulePaint,
- base::Unretained(this)));
+ base::CallbackListSubscription paint_as_active_subscription_ =
+ frame_->RegisterPaintAsActiveChangedCallback(
+ base::BindRepeating(&CustomFrameView::SchedulePaint,
+ base::Unretained(this)));
DISALLOW_COPY_AND_ASSIGN(CustomFrameView);
};
diff --git a/weblayer/browser/cookie_manager_browsertest.cc b/weblayer/browser/cookie_manager_browsertest.cc
index ca2cc70..a7da2970 100644
--- a/weblayer/browser/cookie_manager_browsertest.cc
+++ b/weblayer/browser/cookie_manager_browsertest.cc
@@ -57,7 +57,7 @@
embedded_test_server()->GetURL("/simple_page.html"), shell());
GURL base_url = embedded_test_server()->base_url();
- auto subscription =
+ base::CallbackListSubscription subscription =
GetProfile()->GetCookieManager()->AddCookieChangedCallback(
base_url, nullptr,
base::BindRepeating(&CookieManagerBrowserTest::OnCookieChanged,
@@ -79,13 +79,13 @@
GURL base_url = embedded_test_server()->base_url();
std::string cookie1 = "cookie1";
- auto subscription1 =
+ base::CallbackListSubscription subscription1 =
GetProfile()->GetCookieManager()->AddCookieChangedCallback(
base_url, &cookie1,
base::BindRepeating(&CookieManagerBrowserTest::OnCookieChanged,
base::Unretained(this)));
std::string cookie2 = "cookie2";
- auto subscription2 =
+ base::CallbackListSubscription subscription2 =
GetProfile()->GetCookieManager()->AddCookieChangedCallback(
base_url, &cookie2,
base::BindRepeating(&CookieManagerBrowserTest::OnCookieChanged,
@@ -99,7 +99,7 @@
}
Reset();
- subscription1 = nullptr;
+ subscription1 = {};
// Set cookie1 first and then cookie2. We should only receive a cookie change
// event for cookie2.
diff --git a/weblayer/browser/cookie_manager_impl.cc b/weblayer/browser/cookie_manager_impl.cc
index 4b5262e..5e79d78 100644
--- a/weblayer/browser/cookie_manager_impl.cc
+++ b/weblayer/browser/cookie_manager_impl.cc
@@ -78,10 +78,10 @@
base::BindOnce(&GetCookieComplete, std::move(callback)));
}
-std::unique_ptr<CookieManager::CookieChangedSubscription>
-CookieManagerImpl::AddCookieChangedCallback(const GURL& url,
- const std::string* name,
- CookieChangedCallback callback) {
+base::CallbackListSubscription CookieManagerImpl::AddCookieChangedCallback(
+ const GURL& url,
+ const std::string* name,
+ CookieChangedCallback callback) {
auto callback_list = std::make_unique<CookieChangedCallbackList>();
auto* callback_list_ptr = callback_list.get();
int id = AddCookieChangedCallbackInternal(
diff --git a/weblayer/browser/cookie_manager_impl.h b/weblayer/browser/cookie_manager_impl.h
index 76cad27..7c513cd 100644
--- a/weblayer/browser/cookie_manager_impl.h
+++ b/weblayer/browser/cookie_manager_impl.h
@@ -35,7 +35,7 @@
const std::string& value,
SetCookieCallback callback) override;
void GetCookie(const GURL& url, GetCookieCallback callback) override;
- std::unique_ptr<CookieChangedSubscription> AddCookieChangedCallback(
+ base::CallbackListSubscription AddCookieChangedCallback(
const GURL& url,
const std::string* name,
CookieChangedCallback callback) override;
diff --git a/weblayer/browser/i18n_util.cc b/weblayer/browser/i18n_util.cc
index a84bdc5..5554abe4 100644
--- a/weblayer/browser/i18n_util.cc
+++ b/weblayer/browser/i18n_util.cc
@@ -43,7 +43,7 @@
return net::HttpUtil::ExpandLanguageList(locale_list);
}
-std::unique_ptr<LocaleChangeSubscription> RegisterLocaleChangeCallback(
+base::CallbackListSubscription RegisterLocaleChangeCallback(
base::RepeatingClosure locale_changed) {
return GetLocaleChangeCallbacks().Add(locale_changed);
}
diff --git a/weblayer/browser/i18n_util.h b/weblayer/browser/i18n_util.h
index c0607cf..f9b94341 100644
--- a/weblayer/browser/i18n_util.h
+++ b/weblayer/browser/i18n_util.h
@@ -19,9 +19,7 @@
// This may be called on any thread.
std::string GetAcceptLangs();
-using LocaleChangeSubscription = base::CallbackList<void()>::Subscription;
-
-std::unique_ptr<LocaleChangeSubscription> RegisterLocaleChangeCallback(
+base::CallbackListSubscription RegisterLocaleChangeCallback(
base::RepeatingClosure locale_changed);
} // namespace i18n
diff --git a/weblayer/browser/profile_impl.h b/weblayer/browser/profile_impl.h
index 6ddfd4ef..c992963 100644
--- a/weblayer/browser/profile_impl.h
+++ b/weblayer/browser/profile_impl.h
@@ -181,7 +181,7 @@
DownloadDelegate* download_delegate_ = nullptr;
- std::unique_ptr<i18n::LocaleChangeSubscription> locale_change_subscription_;
+ base::CallbackListSubscription locale_change_subscription_;
std::unique_ptr<CookieManagerImpl> cookie_manager_;
std::unique_ptr<PrerenderControllerImpl> prerender_controller_;
diff --git a/weblayer/browser/tab_impl.h b/weblayer/browser/tab_impl.h
index 44de7f26..be04aba 100644
--- a/weblayer/browser/tab_impl.h
+++ b/weblayer/browser/tab_impl.h
@@ -371,7 +371,7 @@
std::unique_ptr<content::WebContents> web_contents_;
std::unique_ptr<NavigationControllerImpl> navigation_controller_;
base::ObserverList<TabObserver>::Unchecked observers_;
- std::unique_ptr<i18n::LocaleChangeSubscription> locale_change_subscription_;
+ base::CallbackListSubscription locale_change_subscription_;
#if defined(OS_ANDROID)
BrowserControlsContainerView* top_controls_container_view_ = nullptr;
diff --git a/weblayer/browser/translate_browsertest.cc b/weblayer/browser/translate_browsertest.cc
index 700e9d0..effcfb82 100644
--- a/weblayer/browser/translate_browsertest.cc
+++ b/weblayer/browser/translate_browsertest.cc
@@ -217,9 +217,7 @@
translate::TranslateErrors::Type error_type_ =
translate::TranslateErrors::NONE;
- std::unique_ptr<
- translate::TranslateManager::TranslateErrorCallbackList::Subscription>
- error_subscription_;
+ base::CallbackListSubscription error_subscription_;
std::string script_;
};
diff --git a/weblayer/public/cookie_manager.h b/weblayer/public/cookie_manager.h
index cacfa0c9..5ba676abb 100644
--- a/weblayer/public/cookie_manager.h
+++ b/weblayer/public/cookie_manager.h
@@ -35,8 +35,7 @@
using CookieChangedCallbackList =
base::CallbackList<void(const net::CookieChangeInfo&)>;
using CookieChangedCallback = CookieChangedCallbackList::CallbackType;
- using CookieChangedSubscription = CookieChangedCallbackList::Subscription;
- virtual std::unique_ptr<CookieChangedSubscription> AddCookieChangedCallback(
+ virtual base::CallbackListSubscription AddCookieChangedCallback(
const GURL& url,
const std::string* name,
CookieChangedCallback callback) = 0;