Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3409)

Unified Diff: chrome/browser/devtools/device/devtools_android_bridge.h

Issue 305013013: DevTools: DevToolsAndroidBridge polling loops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added check Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/devtools/device/devtools_android_bridge.h
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.h b/chrome/browser/devtools/device/devtools_android_bridge.h
index 3f4ce20c74d0643d53fe51f59811f295f75ded34..58af93b2470c886c509d067b77223442d2d626f1 100644
--- a/chrome/browser/devtools/device/devtools_android_bridge.h
+++ b/chrome/browser/devtools/device/devtools_android_bridge.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/cancelable_callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h"
@@ -212,6 +213,11 @@ class DevToolsAndroidBridge
device_manager_->SetDeviceProviders(device_providers);
}
+ void set_device_count_scheduler_for_test(
+ base::Callback<void(base::Closure)> scheduler) {
+ device_count_scheduler_for_test_ = scheduler;
+ }
+
static bool HasDevToolsWindow(const std::string& agent_id);
private:
@@ -221,10 +227,14 @@ class DevToolsAndroidBridge
virtual ~DevToolsAndroidBridge();
- void RequestDeviceList();
- void ReceivedDeviceList(scoped_ptr<RemoteDevices> devices);
- void RequestDeviceCount();
+ void StartDeviceListPolling();
+ void StopDeviceListPolling();
+ void RequestDeviceList(
+ const base::Callback<void(const RemoteDevices&)>& callback);
+ void ReceivedDeviceList(const RemoteDevices& devices);
+ void RequestDeviceCount(const base::Callback<void(int)>& callback);
void ReceivedDeviceCount(int count);
+ void ScheduleDeviceCountRequest(const base::Closure& callback);
void CreateDeviceProviders();
@@ -234,9 +244,12 @@ class DevToolsAndroidBridge
typedef std::vector<DeviceListListener*> DeviceListListeners;
DeviceListListeners device_list_listeners_;
+ base::CancelableCallback<void(const RemoteDevices&)> device_list_callback_;
typedef std::vector<DeviceCountListener*> DeviceCountListeners;
DeviceCountListeners device_count_listeners_;
+ base::CancelableCallback<void(int)> device_count_callback_;
+ base::Callback<void(base::Closure)> device_count_scheduler_for_test_;
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge);

Powered by Google App Engine
This is Rietveld 408576698