| 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 |
| 85 void MediaRouterBase::OnRouteControllerDestroyed( |
| 86 const MediaRoute::Id& route_id) {} |
| 87 |
| 79 MediaRouterBase::MediaRouterBase() : initialized_(false) {} | 88 MediaRouterBase::MediaRouterBase() : initialized_(false) {} |
| 80 | 89 |
| 81 // static | 90 // static |
| 82 std::string MediaRouterBase::CreatePresentationId() { | 91 std::string MediaRouterBase::CreatePresentationId() { |
| 83 return "mr_" + base::GenerateGUID(); | 92 return "mr_" + base::GenerateGUID(); |
| 84 } | 93 } |
| 85 | 94 |
| 86 void MediaRouterBase::NotifyPresentationConnectionStateChange( | 95 void MediaRouterBase::NotifyPresentationConnectionStateChange( |
| 87 const MediaRoute::Id& route_id, | 96 const MediaRoute::Id& route_id, |
| 88 content::PresentationConnectionState state) { | 97 content::PresentationConnectionState state) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 141 } |
| 133 } | 142 } |
| 134 | 143 |
| 135 void MediaRouterBase::Shutdown() { | 144 void MediaRouterBase::Shutdown() { |
| 136 // The observer calls virtual methods on MediaRouter; it must be destroyed | 145 // The observer calls virtual methods on MediaRouter; it must be destroyed |
| 137 // outside of the dtor | 146 // outside of the dtor |
| 138 internal_routes_observer_.reset(); | 147 internal_routes_observer_.reset(); |
| 139 } | 148 } |
| 140 | 149 |
| 141 } // namespace media_router | 150 } // namespace media_router |
| OLD | NEW |