Chromium Code Reviews| Index: chrome/browser/media/router/media_router_base.cc |
| diff --git a/chrome/browser/media/router/media_router_base.cc b/chrome/browser/media/router/media_router_base.cc |
| index d5720866a8da621bf6c9299614eca7b454a03f4b..579cb5c6ffca71efa374f53729a98323214aad3a 100644 |
| --- a/chrome/browser/media/router/media_router_base.cc |
| +++ b/chrome/browser/media/router/media_router_base.cc |
| @@ -10,6 +10,9 @@ |
| #include "base/stl_util.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#if !defined(OS_ANDROID) |
| +#include "chrome/browser/ui/toolbar/media_router_action_controller.h" |
| +#endif |
| #include "content/public/browser/browser_thread.h" |
| namespace media_router { |
| @@ -72,7 +75,15 @@ void MediaRouterBase::OnIncognitoProfileShutdown() { |
| TerminateRoute(route_id); |
| } |
| -MediaRouterBase::MediaRouterBase() : initialized_(false) {} |
| +#if !defined(OS_ANDROID) |
| +MediaRouterActionController* MediaRouterBase::GetActionController() { |
| + return action_controller_.get(); |
| +} |
| +#endif |
| + |
| +MediaRouterBase::MediaRouterBase(Profile* profile) |
| + : initialized_(false), |
| + profile_(profile) {} |
| // static |
| std::string MediaRouterBase::CreatePresentationId() { |
| @@ -110,9 +121,15 @@ bool MediaRouterBase::HasJoinableRoute() const { |
| void MediaRouterBase::Initialize() { |
| DCHECK(!initialized_); |
| - // The observer calls virtual methods on MediaRouter; it must be created |
| - // outside of the ctor |
| + // |internal_routes_observer_| and |action_controller_| call virtual methods |
| + // on MediaRouter; they must be created outside of the ctor. |
| internal_routes_observer_.reset(new InternalMediaRoutesObserver(this)); |
| +#if !defined(OS_ANDROID) |
| + // TODO(takumif): Actually instantiate MediaRouterActionController here to |
| + // enable ephemeral toolbar icon. |
| + action_controller_.reset(); |
|
mark a. foltz
2016/09/02 22:19:09
Can this TODO be done now?
takumif
2016/09/07 21:48:32
We need to change MRAction to use MRActionControll
|
| +#endif |
| + |
| initialized_ = true; |
| } |
| @@ -124,9 +141,12 @@ void MediaRouterBase::OnPresentationConnectionStateCallbackRemoved( |
| } |
| void MediaRouterBase::Shutdown() { |
| - // The observer calls virtual methods on MediaRouter; it must be destroyed |
| - // outside of the dtor |
| + // |internal_routes_observer_| and |action_controller_| call virtual methods |
| + // on MediaRouter; they must be destroyed outside of the dtor. |
| internal_routes_observer_.reset(); |
| +#if !defined(OS_ANDROID) |
| + action_controller_.reset(); |
| +#endif |
| } |
| } // namespace media_router |