Chromium Code Reviews| 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 1aba1c75a70a08b9e6ee504004dcebfcb7535b30..5ec124ab6b7a87d3b8e8b92e5fe27c2a0861e21a 100644 |
| --- a/chrome/browser/extensions/api/dial/dial_api.h |
| +++ b/chrome/browser/extensions/api/dial/dial_api.h |
| @@ -10,6 +10,7 @@ |
| #include "base/macros.h" |
| #include "chrome/browser/extensions/api/dial/dial_device_data.h" |
| #include "chrome/browser/extensions/api/dial/dial_registry.h" |
| +#include "chrome/browser/media/router/discovery/discovery_network_monitor.h" |
| #include "chrome/common/extensions/api/dial.h" |
| #include "components/keyed_service/core/refcounted_keyed_service.h" |
| #include "extensions/browser/api/async_api_function.h" |
| @@ -46,7 +47,8 @@ class DialFetchDeviceDescriptionFunction; |
| // real DialRegsitry. |
| class DialAPI : public RefcountedKeyedService, |
| public EventRouter::Observer, |
| - public api::dial::DialRegistry::Observer { |
| + public api::dial::DialRegistry::Observer, |
| + public DiscoveryNetworkMonitor::Observer { |
|
mark a. foltz
2017/04/26 22:25:11
I'd put the extensions API changes in a separate p
btolsch
2017/05/03 22:03:09
Done.
|
| public: |
| explicit DialAPI(Profile* profile); |
| @@ -81,6 +83,14 @@ class DialAPI : public RefcountedKeyedService, |
| const api::dial::DialRegistry::DeviceList& devices) override; |
| void OnDialError(api::dial::DialRegistry::DialErrorCode type) override; |
| + // DiscoveryNetworkMonitor::Observer: |
| + void OnNetworksChanged(const DiscoveryNetworkMonitor& manager) override; |
| + |
| + void SendNetworkIdChangedOnUIThread(const std::string& network_id); |
| + |
| + void NetworkIdListenerAddedOnIOThread(); |
| + void NetworkIdListenerRemovedOnIOThread(); |
| + |
| // Methods to notify the DialRegistry on the correct thread of new/removed |
| // listeners. |
| void NotifyListenerAddedOnIOThread(); |
| @@ -157,6 +167,25 @@ class DialFetchDeviceDescriptionFunction : public AsyncExtensionFunction { |
| DISALLOW_COPY_AND_ASSIGN(DialFetchDeviceDescriptionFunction); |
| }; |
| +class DialGetNetworkIdFunction : public AsyncExtensionFunction { |
| + public: |
| + DialGetNetworkIdFunction(); |
| + |
| + protected: |
| + ~DialGetNetworkIdFunction() override; |
| + |
| + // AsyncExtensionFunction: |
| + bool RunAsync() override; |
| + |
| + private: |
| + DECLARE_EXTENSION_FUNCTION("dial.getNetworkId", DIAL_GETNETWORKID) |
| + |
| + void GetNetworkIdOnIOThread(); |
| + void NetworkInfoReadyCallback(); |
|
mark a. foltz
2017/04/26 22:25:11
OnNetworkInfoReady
btolsch
2017/05/03 22:03:09
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DialGetNetworkIdFunction); |
| +}; |
| + |
| } // namespace extensions |
| #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |