| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "chrome/browser/media/router/discovery/dial/device_description_service.
h" | 11 #include "chrome/browser/media/router/discovery/dial/device_description_service.
h" |
| 12 #include "chrome/browser/media/router/discovery/dial/dial_registry.h" | 12 #include "chrome/browser/media/router/discovery/dial/dial_registry.h" |
| 13 #include "chrome/browser/media/router/discovery/media_sink_service_base.h" | 13 #include "chrome/browser/media/router/discovery/media_sink_service_base.h" |
| 14 #include "chrome/browser/media/router/media_router_metrics.h" |
| 14 | 15 |
| 15 namespace media_router { | 16 namespace media_router { |
| 16 | 17 |
| 17 class DeviceDescriptionService; | 18 class DeviceDescriptionService; |
| 18 class DialRegistry; | 19 class DialRegistry; |
| 19 | 20 |
| 20 // A service which can be used to start background discovery and resolution of | 21 // A service which can be used to start background discovery and resolution of |
| 21 // DIAL devices (Smart TVs, Game Consoles, etc.). | 22 // DIAL devices (Smart TVs, Game Consoles, etc.). |
| 22 // This class is not thread safe. All methods must be called from the IO thread. | 23 // This class is not thread safe. All methods must be called from the IO thread. |
| 23 class DialMediaSinkServiceImpl : public MediaSinkServiceBase, | 24 class DialMediaSinkServiceImpl : public MediaSinkServiceBase, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Called when description service successfully fetches and parses device | 57 // Called when description service successfully fetches and parses device |
| 57 // description XML. Restart |finish_timer_| if it is not running. | 58 // description XML. Restart |finish_timer_| if it is not running. |
| 58 void OnDeviceDescriptionAvailable( | 59 void OnDeviceDescriptionAvailable( |
| 59 const DialDeviceData& device_data, | 60 const DialDeviceData& device_data, |
| 60 const ParsedDialDeviceDescription& description_data); | 61 const ParsedDialDeviceDescription& description_data); |
| 61 | 62 |
| 62 // Called when fails to fetch or parse device description XML. | 63 // Called when fails to fetch or parse device description XML. |
| 63 void OnDeviceDescriptionError(const DialDeviceData& device, | 64 void OnDeviceDescriptionError(const DialDeviceData& device, |
| 64 const std::string& error_message); | 65 const std::string& error_message); |
| 65 | 66 |
| 67 // MediaSinkServiceBase implementation. |
| 68 void RecordDeviceCounts() override; |
| 69 |
| 66 std::unique_ptr<DeviceDescriptionService> description_service_; | 70 std::unique_ptr<DeviceDescriptionService> description_service_; |
| 67 | 71 |
| 68 // Raw pointer to DialRegistry singleton. | 72 // Raw pointer to DialRegistry singleton. |
| 69 DialRegistry* dial_registry_ = nullptr; | 73 DialRegistry* dial_registry_ = nullptr; |
| 70 | 74 |
| 71 // DialRegistry for unit test. | 75 // DialRegistry for unit test. |
| 72 DialRegistry* test_dial_registry_ = nullptr; | 76 DialRegistry* test_dial_registry_ = nullptr; |
| 73 | 77 |
| 74 // Device data list from current round of discovery. | 78 // Device data list from current round of discovery. |
| 75 DialRegistry::DeviceList current_devices_; | 79 DialRegistry::DeviceList current_devices_; |
| 76 | 80 |
| 77 scoped_refptr<net::URLRequestContextGetter> request_context_; | 81 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 82 |
| 83 MediaRouterMetrics metrics_; |
| 78 }; | 84 }; |
| 79 | 85 |
| 80 } // namespace media_router | 86 } // namespace media_router |
| 81 | 87 |
| 82 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IM
PL_H_ | 88 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IM
PL_H_ |
| OLD | NEW |