Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/media/router/media_route_factory.cc

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698