OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/media/router/media_route_factory.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/media/router/media_route.h" |
| 10 |
| 11 namespace media_router { |
| 12 namespace { |
| 13 const char kRoutePrefix[] = "route-local-"; |
| 14 } // namespace |
| 15 |
| 16 MediaRouteFactory::MediaRouteFactory() : next_id_(0) {} |
| 17 |
| 18 std::string MediaRouteFactory::NextRouteId() { |
| 19 return kRoutePrefix + base::Uint64ToString(next_id_++); |
| 20 } |
| 21 |
| 22 // static |
| 23 MediaRouteFactory* MediaRouteFactory::GetInstance() { |
| 24 return Singleton<MediaRouteFactory>::get(); |
| 25 } |
| 26 |
| 27 MediaRoute MediaRouteFactory::Create(const MediaSource& media_source, |
| 28 const MediaSinkId& sink_id, |
| 29 const std::string& description, |
| 30 bool is_local) { |
| 31 DCHECK(CalledOnValidThread()); |
| 32 return MediaRoute(NextRouteId(), media_source, sink_id, description, |
| 33 is_local); |
| 34 } |
| 35 |
| 36 } // namespace media_router |
OLD | NEW |