Index: chrome/browser/extensions/api/dial/dial_api.h |
diff --git a/chrome/browser/extensions/api/dial/dial_api.h b/chrome/browser/extensions/api/dial/dial_api.h |
index 74e284ee6370b433d3788f2d841e6bad55d2ee52..d6f8327e5722369d3632257605ace80b29bb8134 100644 |
--- a/chrome/browser/extensions/api/dial/dial_api.h |
+++ b/chrome/browser/extensions/api/dial/dial_api.h |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/extensions/api/api_function.h" |
#include "chrome/browser/extensions/api/dial/dial_device_data.h" |
#include "chrome/browser/extensions/api/dial/dial_registry.h" |
+#include "chrome/browser/extensions/api/dial/mdns_service.h" |
#include "chrome/browser/extensions/event_router.h" |
#include "components/browser_context_keyed_service/refcounted_browser_context_keyed_service.h" |
@@ -30,6 +31,7 @@ class DialAPI : public RefcountedBrowserContextKeyedService, |
// The DialRegistry for the API. This must always be used only from the IO |
// thread. |
DialRegistry* dial_registry(); |
+ MDNSService* mdns_service(); |
// Called by the DialRegistry on the IO thread so that the DialAPI dispatches |
// the event to listeners on the UI thread. |
@@ -60,6 +62,7 @@ class DialAPI : public RefcountedBrowserContextKeyedService, |
// Created lazily on first access on the IO thread. |
scoped_ptr<DialRegistry> dial_registry_; |
+ scoped_ptr<MDNSService> mdns_service_; |
DISALLOW_COPY_AND_ASSIGN(DialAPI); |
}; |
@@ -96,6 +99,36 @@ class DialDiscoverNowFunction : public AsyncApiFunction { |
DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); |
}; |
+// DiscoverNow function. This function needs a round-trip from the IO thread |
+// because it needs to grab a pointer to the DIAL API in order to get a |
+// reference to the DialRegistry while on the IO thread. Then, the result |
+// must be returned on the UI thread. |
mark a. foltz
2013/08/19 18:25:26
Leftover comments?
|
+class DialGetNetworkServicesFunction : public AsyncApiFunction { |
+ public: |
+ DialGetNetworkServicesFunction(); |
+ |
+ protected: |
+ virtual ~DialGetNetworkServicesFunction() {} |
+ |
+ // AsyncApiFunction: |
+ virtual bool Prepare() OVERRIDE; |
+ virtual void Work() OVERRIDE; |
+ virtual bool Respond() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("dial.getNetworkServices", DIAL_GETNETWORKSERVICES) |
+ |
+ // Pointer to the DIAL API for this profile. We get this on the UI thread. |
+ DialAPI* dial_; |
+ |
+ // Result of the discoverNow call to the DIAL registry. This result is |
+ // retrieved on the IO thread but the function result is returned on the UI |
+ // thread. |
+ bool result_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DialGetNetworkServicesFunction); |
+}; |
+ |
} // namespace api |
} // namespace extensions |