Commit 746a2e20 authored by Leonard Grey's avatar Leonard Grey Committed by Chromium LUCI CQ

[Code Health] Convert callbacks in DevtoolsWindow to BindRepeating

Bug: 1152274
Change-Id: I96773aca058a77390d8f2e8ea818dd56cc7c5f4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581462Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835679}
parent aa9d555e
...@@ -38,8 +38,8 @@ DevToolsEyeDropper::DevToolsEyeDropper(content::WebContents* web_contents, ...@@ -38,8 +38,8 @@ DevToolsEyeDropper::DevToolsEyeDropper(content::WebContents* web_contents,
last_cursor_x_(-1), last_cursor_x_(-1),
last_cursor_y_(-1), last_cursor_y_(-1),
host_(nullptr) { host_(nullptr) {
mouse_event_callback_ = mouse_event_callback_ = base::BindRepeating(
base::Bind(&DevToolsEyeDropper::HandleMouseEvent, base::Unretained(this)); &DevToolsEyeDropper::HandleMouseEvent, base::Unretained(this));
content::RenderViewHost* rvh = content::RenderViewHost* rvh =
web_contents->GetMainFrame()->GetRenderViewHost(); web_contents->GetMainFrame()->GetRenderViewHost();
if (rvh) if (rvh)
......
...@@ -22,7 +22,7 @@ class WebMouseEvent; ...@@ -22,7 +22,7 @@ class WebMouseEvent;
class DevToolsEyeDropper : public content::WebContentsObserver, class DevToolsEyeDropper : public content::WebContentsObserver,
public viz::mojom::FrameSinkVideoConsumer { public viz::mojom::FrameSinkVideoConsumer {
public: public:
typedef base::Callback<void(int, int, int, int)> EyeDropperCallback; typedef base::RepeatingCallback<void(int, int, int, int)> EyeDropperCallback;
DevToolsEyeDropper(content::WebContents* web_contents, DevToolsEyeDropper(content::WebContents* web_contents,
EyeDropperCallback callback); EyeDropperCallback callback);
......
...@@ -1477,9 +1477,10 @@ void DevToolsWindow::SetEyeDropperActive(bool active) { ...@@ -1477,9 +1477,10 @@ void DevToolsWindow::SetEyeDropperActive(bool active) {
if (!web_contents) if (!web_contents)
return; return;
if (active) { if (active) {
eye_dropper_.reset(new DevToolsEyeDropper( eye_dropper_ = std::make_unique<DevToolsEyeDropper>(
web_contents, base::Bind(&DevToolsWindow::ColorPickedInEyeDropper, web_contents,
base::Unretained(this)))); base::BindRepeating(&DevToolsWindow::ColorPickedInEyeDropper,
base::Unretained(this)));
} else { } else {
eye_dropper_.reset(); eye_dropper_.reset();
} }
......
...@@ -256,7 +256,7 @@ class DevToolsWindow : public DevToolsUIBindings::Delegate, ...@@ -256,7 +256,7 @@ class DevToolsWindow : public DevToolsUIBindings::Delegate,
friend class DevToolsWindowCreationObserver; friend class DevToolsWindowCreationObserver;
friend class HatsNextWebDialogBrowserTest; friend class HatsNextWebDialogBrowserTest;
using CreationCallback = base::Callback<void(DevToolsWindow*)>; using CreationCallback = base::RepeatingCallback<void(DevToolsWindow*)>;
static void AddCreationCallbackForTest(const CreationCallback& callback); static void AddCreationCallbackForTest(const CreationCallback& callback);
static void RemoveCreationCallbackForTest(const CreationCallback& callback); static void RemoveCreationCallbackForTest(const CreationCallback& callback);
......
...@@ -180,7 +180,7 @@ void DevToolsWindowTesting::CloseDevToolsWindowSync( ...@@ -180,7 +180,7 @@ void DevToolsWindowTesting::CloseDevToolsWindowSync(
// DevToolsWindowCreationObserver --------------------------------------------- // DevToolsWindowCreationObserver ---------------------------------------------
DevToolsWindowCreationObserver::DevToolsWindowCreationObserver() DevToolsWindowCreationObserver::DevToolsWindowCreationObserver()
: creation_callback_(base::Bind( : creation_callback_(base::BindRepeating(
&DevToolsWindowCreationObserver::DevToolsWindowCreated, &DevToolsWindowCreationObserver::DevToolsWindowCreated,
base::Unretained(this))) { base::Unretained(this))) {
DevToolsWindow::AddCreationCallbackForTest(creation_callback_); DevToolsWindow::AddCreationCallbackForTest(creation_callback_);
......
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