Commit 21fa06f9 authored by Ella Ge's avatar Ella Ge Committed by Chromium LUCI CQ

Convert chrome/browser/ui/cocoa/ from base::Bind to Once/Repeating

Bug: 1152282
Change-Id: Ib8179b27a3e04191b44b1f932886ce3bdf74f20c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600389Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840213}
parent f2072e2f
......@@ -38,7 +38,7 @@ class FirstRunShowBridge : public base::RefCounted<FirstRunShowBridge> {
public:
FirstRunShowBridge(FirstRunDialogController* controller);
void ShowDialog(const base::Closure& quit_closure);
void ShowDialog(base::OnceClosure quit_closure);
private:
friend class base::RefCounted<FirstRunShowBridge>;
......@@ -52,12 +52,12 @@ FirstRunShowBridge::FirstRunShowBridge(
FirstRunDialogController* controller) : controller_(controller) {
}
void FirstRunShowBridge::ShowDialog(const base::Closure& quit_closure) {
void FirstRunShowBridge::ShowDialog(base::OnceClosure quit_closure) {
// Proceeding past the modal dialog requires user interaction. Allow nested
// tasks to run so that signal handlers operate correctly.
base::CurrentThread::ScopedNestableTaskAllower allow_nested;
[controller_ show];
quit_closure.Run();
std::move(quit_closure).Run();
}
FirstRunShowBridge::~FirstRunShowBridge() {}
......
......@@ -30,9 +30,9 @@ FullscreenToolbarAnimationController::FullscreenToolbarAnimationController(
hide_toolbar_timer_(
FROM_HERE,
base::TimeDelta::FromMilliseconds(kTabStripChangesDelay),
base::Bind(&FullscreenToolbarAnimationController::
AnimateToolbarOutIfPossible,
base::Unretained(this))),
base::BindRepeating(&FullscreenToolbarAnimationController::
AnimateToolbarOutIfPossible,
base::Unretained(this))),
animation_start_value_(0),
should_hide_toolbar_after_delay_(false) {
animation_.SetSlideDuration(base::TimeDelta::FromMilliseconds(200));
......
......@@ -400,8 +400,8 @@ void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) {
base::CancelableTaskTracker::TaskId task_id =
service->GetFaviconImageForPageURL(
item->url,
base::Bind(
&HistoryMenuBridge::GotFaviconData, base::Unretained(this), item),
base::BindOnce(&HistoryMenuBridge::GotFaviconData,
base::Unretained(this), item),
&cancelable_task_tracker_);
item->icon_task_id = task_id;
item->icon_requested = true;
......
......@@ -73,12 +73,13 @@ void UpdateItemForWebContents(NSMenuItem* item,
TabMenuBridge::TabMenuBridge(TabStripModel* model, NSMenuItem* menu_item)
: model_(model), menu_item_(menu_item) {
menu_listener_.reset([[TabMenuListener alloc]
initWithCallback:base::Bind(&TabMenuBridge::OnDynamicItemChosen,
// Unretained is safe here: this class owns
// MenuListener, which holds the callback
// being constructed here, so the callback
// will be destructed before this class.
base::Unretained(this))]);
initWithCallback:base::BindRepeating(
&TabMenuBridge::OnDynamicItemChosen,
// Unretained is safe here: this class owns
// MenuListener, which holds the callback
// being constructed here, so the callback
// will be destructed before this class.
base::Unretained(this))]);
model_->AddObserver(this);
}
......
......@@ -106,7 +106,7 @@ class TaskManagerMacTest : public InProcessBrowserTest {
int FindRowForTab(content::WebContents* tab) {
SessionID tab_id = sessions::SessionTabHelper::IdForTab(tab);
std::unique_ptr<TaskManagerTester> tester =
TaskManagerTester::Create(base::Closure());
TaskManagerTester::Create(base::RepeatingClosure());
for (int i = 0; i < tester->GetRowCount(); ++i) {
if (tester->GetTabId(i) == tab_id)
return i;
......@@ -230,7 +230,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerMacTest, SelectionConsistency) {
// Find the three tabs we set up, in TaskManager model order. Because we have
// not sorted the table yet, this should also be their UI display order.
std::unique_ptr<TaskManagerTester> tester =
TaskManagerTester::Create(base::Closure());
TaskManagerTester::Create(base::RepeatingClosure());
std::vector<content::WebContents*> tabs;
for (int i = 0; i < tester->GetRowCount(); ++i) {
// Filter based on our title.
......
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