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-"; | |
mark a. foltz
2015/03/05 16:58:41
Per our conversation yesterday, route-local- so we
Kevin M
2015/03/05 18:34:18
Done.
| |
14 } // namespace | |
15 | |
16 MediaRouteFactory::MediaRouteFactory() : next_id_(0) {} | |
17 | |
18 std::string MediaRouteFactory::NextRouteId() { | |
19 std::string output = kRoutePrefix + base::Uint64ToString(next_id_); | |
20 next_id_++; | |
21 return output; | |
mark a. foltz
2015/03/05 16:58:41
Can this function be a one-liner?
Kevin M
2015/03/05 18:34:18
Sure, if you're comfortable with an inline postinc
| |
22 } | |
23 | |
24 // static | |
25 MediaRouteFactory* MediaRouteFactory::GetInstance() { | |
26 return Singleton<MediaRouteFactory>::get(); | |
27 } | |
28 | |
29 MediaRoute MediaRouteFactory::Create(const MediaSource& media_source, | |
30 const MediaSinkId& sink_id, | |
31 const std::string& description, | |
32 bool is_local) { | |
33 return MediaRoute(NextRouteId(), media_source, sink_id, description, | |
34 is_local); | |
35 } | |
36 | |
37 } // namespace media_router | |
OLD | NEW |