Chromium Code Reviews| 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_DELEGATE_MEDIA_ROUTER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ | 6 #define CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ |
| 7 | 7 |
| 8 #include "ash/common/cast_config_delegate.h" | 8 #include "ash/common/cast_config_delegate.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "content/public/browser/notification_observer.h" | |
| 12 #include "content/public/browser/notification_registrar.h" | |
| 11 | 13 |
| 12 namespace media_router { | 14 namespace media_router { |
| 13 class MediaRouter; | 15 class MediaRouter; |
| 14 } | 16 } |
| 15 | 17 |
| 16 class CastDeviceCache; | 18 class CastDeviceCache; |
| 17 | 19 |
| 18 // A class which allows the ash tray to communicate with the media router. | 20 // A class which allows the ash tray to communicate with the media router. |
| 19 class CastConfigDelegateMediaRouter : public ash::CastConfigDelegate { | 21 class CastConfigDelegateMediaRouter : public ash::CastConfigDelegate, |
|
achuithb
2016/10/27 19:38:59
We can now fold this delegate into CastConfigDeleg
jdufault
2016/10/31 21:12:08
Right, this is still used for dependency injection
| |
| 22 public content::NotificationObserver { | |
| 20 public: | 23 public: |
| 21 CastConfigDelegateMediaRouter(); | 24 CastConfigDelegateMediaRouter(); |
| 22 ~CastConfigDelegateMediaRouter() override; | 25 ~CastConfigDelegateMediaRouter() override; |
| 23 | 26 |
| 24 // The MediaRouter is not always enabled. We only use this backend when it is | |
| 25 // enabled. | |
| 26 static bool IsEnabled(); | |
| 27 static void SetMediaRouterForTest(media_router::MediaRouter* media_router); | 27 static void SetMediaRouterForTest(media_router::MediaRouter* media_router); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // CastConfigDelegate: | 30 // CastConfigDelegate: |
| 31 bool HasCastExtension() const override; | |
| 32 void RequestDeviceRefresh() override; | 31 void RequestDeviceRefresh() override; |
| 33 void CastToReceiver(const std::string& receiver_id) override; | 32 void CastToReceiver(const Sink& sink) override; |
| 34 void StopCasting(const std::string& route_id) override; | 33 void StopCasting(const Route& route) override; |
| 35 bool HasOptions() const override; | |
| 36 void LaunchCastOptions() override; | |
| 37 void AddObserver(ash::CastConfigDelegate::Observer* observer) override; | 34 void AddObserver(ash::CastConfigDelegate::Observer* observer) override; |
| 38 void RemoveObserver(ash::CastConfigDelegate::Observer* observer) override; | 35 void RemoveObserver(ash::CastConfigDelegate::Observer* observer) override; |
| 39 | 36 |
| 37 // content::NotificationObserver: | |
| 38 void Observe(int type, | |
| 39 const content::NotificationSource& source, | |
| 40 const content::NotificationDetails& details) override; | |
| 41 | |
| 40 // |devices_| stores the current source/route status that we query from. | 42 // |devices_| stores the current source/route status that we query from. |
| 41 // This will return null until the media router is initialized. | 43 // This will return null until the media router is initialized. |
| 42 CastDeviceCache* devices(); | 44 CastDeviceCache* devices(); |
| 43 std::unique_ptr<CastDeviceCache> devices_; | 45 std::unique_ptr<CastDeviceCache> devices_; |
| 44 | 46 |
| 47 content::NotificationRegistrar registrar_; | |
| 48 | |
| 45 base::ObserverList<ash::CastConfigDelegate::Observer> observer_list_; | 49 base::ObserverList<ash::CastConfigDelegate::Observer> observer_list_; |
| 46 | 50 |
| 47 DISALLOW_COPY_AND_ASSIGN(CastConfigDelegateMediaRouter); | 51 DISALLOW_COPY_AND_ASSIGN(CastConfigDelegateMediaRouter); |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 #endif // CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ | 54 #endif // CHROME_BROWSER_UI_ASH_CAST_CONFIG_DELEGATE_MEDIA_ROUTER_H_ |
| OLD | NEW |