Index: chrome/browser/extensions/api/gcd_private/gcd_private_api.cc |
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc |
index 08c1abefec5c75677136b0a7f788efb2c674ce37..87e923184e45b83097b078810493edc12c69af30 100644 |
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc |
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc |
@@ -154,6 +154,15 @@ void GcdPrivateAPI::DeviceCacheFlushed() { |
known_devices_.clear(); |
} |
+bool GcdPrivateAPI::QueryForDevices() { |
+ if (!privet_device_lister_) |
+ return false; |
+ |
+ privet_device_lister_->DiscoverNewDevices(true); |
+ |
+ return true; |
+} |
+ |
// static |
void GcdPrivateAPI::SetGCDApiFlowFactoryForTests( |
GCDApiFlowFactoryForTests* factory) { |
@@ -235,6 +244,29 @@ void GcdPrivateGetCloudDeviceListFunction::CheckListingDone() { |
Release(); |
} |
+GcdPrivateQueryForNewLocalDevicesFunction:: |
+ GcdPrivateQueryForNewLocalDevicesFunction() { |
+} |
+ |
+GcdPrivateQueryForNewLocalDevicesFunction:: |
+ ~GcdPrivateQueryForNewLocalDevicesFunction() { |
+} |
+ |
+bool GcdPrivateQueryForNewLocalDevicesFunction::RunSync() { |
+ GcdPrivateAPI* gcd_api = |
+ BrowserContextKeyedAPIFactory<GcdPrivateAPI>::Get(GetProfile()); |
+ |
+ if (!gcd_api) |
+ return false; |
+ |
+ if (!gcd_api->QueryForDevices()) { |
+ error_ = "You must first subscribe to onDeviceStateChanged notifications"; |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
GcdPrivateStartSetupFunction::GcdPrivateStartSetupFunction() { |
} |