Commit 60d3eac0 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert ui/message_center away from base::Bind/base::Callback

base::Bind/base::Callback are deprecated in favor of either
base::BindOnce/base::OnceCallback or base::BindRepeating/
base::RepeatingCallback (depending on whether the callback
is invoked once or multiple time).

Convert all uses of base::Bind/base::Callback in ui/message_center
to the recommended methods/types.

Bug: 1007852
Change-Id: I98daa048c8729aaa3d42b35e69d562178c04ab95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831859
Commit-Queue: Peter Beverloo <peter@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701079}
parent a99504bc
......@@ -460,11 +460,9 @@ void MessageCenterImpl::EnterQuietModeWithExpire(
observer.OnQuietModeChanged(true);
quiet_mode_timer_ = std::make_unique<base::OneShotTimer>();
quiet_mode_timer_->Start(
FROM_HERE,
expires_in,
base::Bind(
&MessageCenterImpl::SetQuietMode, base::Unretained(this), false));
quiet_mode_timer_->Start(FROM_HERE, expires_in,
base::BindOnce(&MessageCenterImpl::SetQuietMode,
base::Unretained(this), false));
}
}
......
......@@ -166,7 +166,7 @@ class MessageCenterImplTest : public testing::Test {
}
base::RunLoop* run_loop() const { return run_loop_.get(); }
base::Closure closure() const { return closure_; }
base::RepeatingClosure closure() const { return closure_; }
protected:
std::unique_ptr<Notification> CreateSimpleNotification(
......@@ -217,7 +217,7 @@ class MessageCenterImplTest : public testing::Test {
MessageCenter* message_center_;
std::unique_ptr<base::MessageLoop> loop_;
std::unique_ptr<base::RunLoop> run_loop_;
base::Closure closure_;
base::RepeatingClosure closure_;
DISALLOW_COPY_AND_ASSIGN(MessageCenterImplTest);
};
......@@ -316,7 +316,7 @@ namespace internal {
class MockPopupTimersController : public PopupTimersController {
public:
MockPopupTimersController(MessageCenter* message_center,
base::Closure quit_closure)
base::RepeatingClosure quit_closure)
: PopupTimersController(message_center),
timer_finished_(0),
quit_closure_(quit_closure) {}
......@@ -334,7 +334,7 @@ class MockPopupTimersController : public PopupTimersController {
private:
int timer_finished_;
std::string last_id_;
base::Closure quit_closure_;
base::RepeatingClosure quit_closure_;
};
TEST_F(MessageCenterImplTest, PopupTimersEmptyController) {
......
......@@ -30,9 +30,8 @@ void PopupTimer::Start() {
timeout_ <= passed_ ? base::TimeDelta() : timeout_ - passed_;
start_time_ = base::Time::Now();
timer_->Start(
FROM_HERE, timeout_to_close,
base::Bind(&Delegate::TimerFinished, timer_delegate_, id_));
timer_->Start(FROM_HERE, timeout_to_close,
base::BindOnce(&Delegate::TimerFinished, timer_delegate_, id_));
}
void PopupTimer::Pause() {
......
......@@ -34,7 +34,7 @@ class NotificationDelegateTest : public testing::Test {
TEST_F(NotificationDelegateTest, ClickDelegate) {
auto delegate = base::MakeRefCounted<HandleNotificationClickDelegate>(
base::Bind(&NotificationDelegateTest::BodyClickCallback,
base::BindRepeating(&NotificationDelegateTest::BodyClickCallback,
base::Unretained(this)));
delegate->Click(base::nullopt, base::nullopt);
......@@ -42,8 +42,8 @@ TEST_F(NotificationDelegateTest, ClickDelegate) {
}
TEST_F(NotificationDelegateTest, NullClickDelegate) {
auto delegate =
base::MakeRefCounted<HandleNotificationClickDelegate>(base::Closure());
auto delegate = base::MakeRefCounted<HandleNotificationClickDelegate>(
base::RepeatingClosure());
delegate->Click(base::nullopt, base::nullopt);
EXPECT_EQ(0, callback_count_);
......@@ -51,7 +51,7 @@ TEST_F(NotificationDelegateTest, NullClickDelegate) {
TEST_F(NotificationDelegateTest, ButtonClickDelegate) {
auto delegate = base::MakeRefCounted<HandleNotificationClickDelegate>(
base::Bind(&NotificationDelegateTest::ButtonClickCallback,
base::BindRepeating(&NotificationDelegateTest::ButtonClickCallback,
base::Unretained(this)));
delegate->Click(base::nullopt, base::nullopt);
......
......@@ -25,8 +25,9 @@ class MESSAGE_CENTER_EXPORT MessageViewFactory {
public:
// A function that creates MessageView for a NOTIFICATION_TYPE_CUSTOM
// notification.
typedef base::Callback<std::unique_ptr<MessageView>(const Notification&)>
CustomMessageViewFactoryFunction;
using CustomMessageViewFactoryFunction =
base::RepeatingCallback<std::unique_ptr<MessageView>(
const Notification&)>;
static MessageView* Create(const Notification& notification);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment