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> { ...@@ -38,7 +38,7 @@ class FirstRunShowBridge : public base::RefCounted<FirstRunShowBridge> {
public: public:
FirstRunShowBridge(FirstRunDialogController* controller); FirstRunShowBridge(FirstRunDialogController* controller);
void ShowDialog(const base::Closure& quit_closure); void ShowDialog(base::OnceClosure quit_closure);
private: private:
friend class base::RefCounted<FirstRunShowBridge>; friend class base::RefCounted<FirstRunShowBridge>;
...@@ -52,12 +52,12 @@ FirstRunShowBridge::FirstRunShowBridge( ...@@ -52,12 +52,12 @@ FirstRunShowBridge::FirstRunShowBridge(
FirstRunDialogController* controller) : controller_(controller) { 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 // Proceeding past the modal dialog requires user interaction. Allow nested
// tasks to run so that signal handlers operate correctly. // tasks to run so that signal handlers operate correctly.
base::CurrentThread::ScopedNestableTaskAllower allow_nested; base::CurrentThread::ScopedNestableTaskAllower allow_nested;
[controller_ show]; [controller_ show];
quit_closure.Run(); std::move(quit_closure).Run();
} }
FirstRunShowBridge::~FirstRunShowBridge() {} FirstRunShowBridge::~FirstRunShowBridge() {}
......
...@@ -30,7 +30,7 @@ FullscreenToolbarAnimationController::FullscreenToolbarAnimationController( ...@@ -30,7 +30,7 @@ FullscreenToolbarAnimationController::FullscreenToolbarAnimationController(
hide_toolbar_timer_( hide_toolbar_timer_(
FROM_HERE, FROM_HERE,
base::TimeDelta::FromMilliseconds(kTabStripChangesDelay), base::TimeDelta::FromMilliseconds(kTabStripChangesDelay),
base::Bind(&FullscreenToolbarAnimationController:: base::BindRepeating(&FullscreenToolbarAnimationController::
AnimateToolbarOutIfPossible, AnimateToolbarOutIfPossible,
base::Unretained(this))), base::Unretained(this))),
animation_start_value_(0), animation_start_value_(0),
......
...@@ -400,8 +400,8 @@ void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { ...@@ -400,8 +400,8 @@ void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) {
base::CancelableTaskTracker::TaskId task_id = base::CancelableTaskTracker::TaskId task_id =
service->GetFaviconImageForPageURL( service->GetFaviconImageForPageURL(
item->url, item->url,
base::Bind( base::BindOnce(&HistoryMenuBridge::GotFaviconData,
&HistoryMenuBridge::GotFaviconData, base::Unretained(this), item), base::Unretained(this), item),
&cancelable_task_tracker_); &cancelable_task_tracker_);
item->icon_task_id = task_id; item->icon_task_id = task_id;
item->icon_requested = true; item->icon_requested = true;
......
...@@ -73,7 +73,8 @@ void UpdateItemForWebContents(NSMenuItem* item, ...@@ -73,7 +73,8 @@ void UpdateItemForWebContents(NSMenuItem* item,
TabMenuBridge::TabMenuBridge(TabStripModel* model, NSMenuItem* menu_item) TabMenuBridge::TabMenuBridge(TabStripModel* model, NSMenuItem* menu_item)
: model_(model), menu_item_(menu_item) { : model_(model), menu_item_(menu_item) {
menu_listener_.reset([[TabMenuListener alloc] menu_listener_.reset([[TabMenuListener alloc]
initWithCallback:base::Bind(&TabMenuBridge::OnDynamicItemChosen, initWithCallback:base::BindRepeating(
&TabMenuBridge::OnDynamicItemChosen,
// Unretained is safe here: this class owns // Unretained is safe here: this class owns
// MenuListener, which holds the callback // MenuListener, which holds the callback
// being constructed here, so the callback // being constructed here, so the callback
......
...@@ -106,7 +106,7 @@ class TaskManagerMacTest : public InProcessBrowserTest { ...@@ -106,7 +106,7 @@ class TaskManagerMacTest : public InProcessBrowserTest {
int FindRowForTab(content::WebContents* tab) { int FindRowForTab(content::WebContents* tab) {
SessionID tab_id = sessions::SessionTabHelper::IdForTab(tab); SessionID tab_id = sessions::SessionTabHelper::IdForTab(tab);
std::unique_ptr<TaskManagerTester> tester = std::unique_ptr<TaskManagerTester> tester =
TaskManagerTester::Create(base::Closure()); TaskManagerTester::Create(base::RepeatingClosure());
for (int i = 0; i < tester->GetRowCount(); ++i) { for (int i = 0; i < tester->GetRowCount(); ++i) {
if (tester->GetTabId(i) == tab_id) if (tester->GetTabId(i) == tab_id)
return i; return i;
...@@ -230,7 +230,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerMacTest, SelectionConsistency) { ...@@ -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 // 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. // not sorted the table yet, this should also be their UI display order.
std::unique_ptr<TaskManagerTester> tester = std::unique_ptr<TaskManagerTester> tester =
TaskManagerTester::Create(base::Closure()); TaskManagerTester::Create(base::RepeatingClosure());
std::vector<content::WebContents*> tabs; std::vector<content::WebContents*> tabs;
for (int i = 0; i < tester->GetRowCount(); ++i) { for (int i = 0; i < tester->GetRowCount(); ++i) {
// Filter based on our title. // 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