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

[Code health] Convert JsonRequestCallback to OnceCallback

Bug: 1152274
Change-Id: I6677026925fc0914197e51de557ab5df37d08c39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595835Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840327}
parent 10b076f2
......@@ -114,22 +114,21 @@ DevToolsAndroidBridge::GetBrowserAgentHost(
return DevToolsDeviceDiscovery::CreateBrowserAgentHost(it->second, browser);
}
void DevToolsAndroidBridge::SendJsonRequest(
const std::string& browser_id_str,
const std::string& url,
const JsonRequestCallback& callback) {
void DevToolsAndroidBridge::SendJsonRequest(const std::string& browser_id_str,
const std::string& url,
JsonRequestCallback callback) {
std::string serial;
std::string browser_id;
if (!BrowserIdFromString(browser_id_str, &serial, &browser_id)) {
callback.Run(net::ERR_FAILED, std::string());
std::move(callback).Run(net::ERR_FAILED, std::string());
return;
}
auto it = device_map_.find(serial);
if (it == device_map_.end()) {
callback.Run(net::ERR_FAILED, std::string());
std::move(callback).Run(net::ERR_FAILED, std::string());
return;
}
it->second->SendJsonRequest(browser_id, url, callback);
it->second->SendJsonRequest(browser_id, url, std::move(callback));
}
void DevToolsAndroidBridge::OpenRemotePage(scoped_refptr<RemoteBrowser> browser,
......
......@@ -69,7 +69,7 @@ class DevToolsAndroidBridge : public KeyedService {
using CompleteDevice = DevToolsDeviceDiscovery::CompleteDevice;
using CompleteDevices = DevToolsDeviceDiscovery::CompleteDevices;
using JsonRequestCallback = base::Callback<void(int, const std::string&)>;
using JsonRequestCallback = base::OnceCallback<void(int, const std::string&)>;
class DeviceListListener {
public:
......@@ -130,7 +130,7 @@ class DevToolsAndroidBridge : public KeyedService {
void SendJsonRequest(const std::string& browser_id_str,
const std::string& url,
const JsonRequestCallback& callback);
JsonRequestCallback callback);
using TCPProviderCallback =
base::Callback<void(scoped_refptr<TCPDeviceProvider>)>;
......
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