| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_CAST_CONFIG_CLIENT_MEDIA_ROUTER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ | 6 #define CHROME_BROWSER_UI_ASH_CAST_CONFIG_CLIENT_MEDIA_ROUTER_H_ |
| 7 | 7 |
| 8 #include "ash/common/cast_config_delegate.h" | 8 #include <memory> |
| 9 |
| 10 #include "ash/public/interfaces/cast_config.mojom.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 11 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 16 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 13 | 17 |
| 14 namespace media_router { | 18 namespace media_router { |
| 15 class MediaRouter; | 19 class MediaRouter; |
| 16 } | 20 } |
| 17 | 21 |
| 18 class CastDeviceCache; | 22 class CastDeviceCache; |
| 19 | 23 |
| 20 // A class which allows the ash tray to communicate with the media router. | 24 // A class which allows the ash tray to communicate with the media router. |
| 21 class CastConfigDelegateMediaRouter : public ash::CastConfigDelegate, | 25 class CastConfigClientMediaRouter : public ash::mojom::CastConfigClient, |
| 22 public content::NotificationObserver { | 26 public content::NotificationObserver { |
| 23 public: | 27 public: |
| 24 CastConfigDelegateMediaRouter(); | 28 CastConfigClientMediaRouter(); |
| 25 ~CastConfigDelegateMediaRouter() override; | 29 ~CastConfigClientMediaRouter() override; |
| 26 | 30 |
| 27 static void SetMediaRouterForTest(media_router::MediaRouter* media_router); | 31 static void SetMediaRouterForTest(media_router::MediaRouter* media_router); |
| 28 | 32 |
| 33 // Calls flush on the underlying associated binding pipe. This is needed |
| 34 // during synchronous setup in tests. |
| 35 void FlushForTesting(); |
| 36 |
| 29 private: | 37 private: |
| 30 // CastConfigDelegate: | 38 // CastConfigClient: |
| 31 void RequestDeviceRefresh() override; | 39 void RequestDeviceRefresh() override; |
| 32 void CastToSink(const Sink& sink) override; | 40 void CastToSink(ash::mojom::CastSinkPtr sink) override; |
| 33 void StopCasting(const Route& route) override; | 41 void StopCasting(ash::mojom::CastRoutePtr route) override; |
| 34 void AddObserver(ash::CastConfigDelegate::Observer* observer) override; | |
| 35 void RemoveObserver(ash::CastConfigDelegate::Observer* observer) override; | |
| 36 | 42 |
| 37 // content::NotificationObserver: | 43 // content::NotificationObserver: |
| 38 void Observe(int type, | 44 void Observe(int type, |
| 39 const content::NotificationSource& source, | 45 const content::NotificationSource& source, |
| 40 const content::NotificationDetails& details) override; | 46 const content::NotificationDetails& details) override; |
| 41 | 47 |
| 42 // |devices_| stores the current source/route status that we query from. | 48 // |devices_| stores the current source/route status that we query from. |
| 43 // This will return null until the media router is initialized. | 49 // This will return null until the media router is initialized. |
| 44 CastDeviceCache* devices(); | 50 CastDeviceCache* devices(); |
| 45 std::unique_ptr<CastDeviceCache> devices_; | 51 std::unique_ptr<CastDeviceCache> devices_; |
| 46 | 52 |
| 47 content::NotificationRegistrar registrar_; | 53 content::NotificationRegistrar registrar_; |
| 48 | 54 |
| 49 base::ObserverList<ash::CastConfigDelegate::Observer> observer_list_; | 55 ash::mojom::CastConfigPtr cast_config_; |
| 50 | 56 |
| 51 DISALLOW_COPY_AND_ASSIGN(CastConfigDelegateMediaRouter); | 57 mojo::AssociatedBinding<ash::mojom::CastConfigClient> binding_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(CastConfigClientMediaRouter); |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 #endif // CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ | 62 #endif // CHROME_BROWSER_UI_ASH_CAST_CONFIG_CLIENT_MEDIA_ROUTER_H_ |
| OLD | NEW |