| 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 #include "chrome/browser/media/router/media_router_base.h" | 5 #include "chrome/browser/media/router/media_router_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/media/router/mojo/media_route_controller.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 namespace media_router { | 16 namespace media_router { |
| 16 | 17 |
| 17 // A MediaRoutesObserver that maintains state about the current set of media | 18 // A MediaRoutesObserver that maintains state about the current set of media |
| 18 // routes. | 19 // routes. |
| 19 class MediaRouterBase::InternalMediaRoutesObserver | 20 class MediaRouterBase::InternalMediaRoutesObserver |
| 20 : public MediaRoutesObserver { | 21 : public MediaRoutesObserver { |
| 21 public: | 22 public: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 70 |
| 70 void MediaRouterBase::OnIncognitoProfileShutdown() { | 71 void MediaRouterBase::OnIncognitoProfileShutdown() { |
| 71 for (const auto& route_id : internal_routes_observer_->incognito_route_ids) | 72 for (const auto& route_id : internal_routes_observer_->incognito_route_ids) |
| 72 TerminateRoute(route_id); | 73 TerminateRoute(route_id); |
| 73 } | 74 } |
| 74 | 75 |
| 75 std::vector<MediaRoute> MediaRouterBase::GetCurrentRoutes() const { | 76 std::vector<MediaRoute> MediaRouterBase::GetCurrentRoutes() const { |
| 76 return internal_routes_observer_->current_routes; | 77 return internal_routes_observer_->current_routes; |
| 77 } | 78 } |
| 78 | 79 |
| 80 scoped_refptr<MediaRouteController> MediaRouterBase::GetRouteController( |
| 81 const MediaRoute::Id& route_id) { |
| 82 return nullptr; |
| 83 } |
| 84 |
| 79 MediaRouterBase::MediaRouterBase() : initialized_(false) {} | 85 MediaRouterBase::MediaRouterBase() : initialized_(false) {} |
| 80 | 86 |
| 81 // static | 87 // static |
| 82 std::string MediaRouterBase::CreatePresentationId() { | 88 std::string MediaRouterBase::CreatePresentationId() { |
| 83 return "mr_" + base::GenerateGUID(); | 89 return "mr_" + base::GenerateGUID(); |
| 84 } | 90 } |
| 85 | 91 |
| 86 void MediaRouterBase::NotifyPresentationConnectionStateChange( | 92 void MediaRouterBase::NotifyPresentationConnectionStateChange( |
| 87 const MediaRoute::Id& route_id, | 93 const MediaRoute::Id& route_id, |
| 88 content::PresentationConnectionState state) { | 94 content::PresentationConnectionState state) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 presentation_connection_state_callbacks_.erase(route_id); | 137 presentation_connection_state_callbacks_.erase(route_id); |
| 132 } | 138 } |
| 133 } | 139 } |
| 134 | 140 |
| 135 void MediaRouterBase::Shutdown() { | 141 void MediaRouterBase::Shutdown() { |
| 136 // The observer calls virtual methods on MediaRouter; it must be destroyed | 142 // The observer calls virtual methods on MediaRouter; it must be destroyed |
| 137 // outside of the dtor | 143 // outside of the dtor |
| 138 internal_routes_observer_.reset(); | 144 internal_routes_observer_.reset(); |
| 139 } | 145 } |
| 140 | 146 |
| 147 void MediaRouterBase::DetachRouteController(const MediaRoute::Id& route_id, |
| 148 MediaRouteController* controller) {} |
| 149 |
| 141 } // namespace media_router | 150 } // namespace media_router |
| OLD | NEW |