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

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

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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/singleton.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "chrome/browser/media/router/media_sink.h"
15 #include "chrome/browser/media/router/media_source.h"
16
17 namespace media_router {
18
19 class MediaRoute;
20
21 // Shared singleton which coordinates the assignment of unique IDs to
22 // MediaRoute objects.
23 class MediaRouteFactory : public base::NonThreadSafe {
24 public:
25 static MediaRouteFactory* GetInstance();
26
27 // Returns a MediaRoute object with a unique ID.
28 // |type|: Type of media route.
29 // |media_source|: Description of source of the route.
30 // |sink_id|: ID of the MediaSink of the route.
31 // |description|: Description of the route to be displayed.
32 // |is_local|: true if the route was created from this browser.
33 MediaRoute Create(const MediaSource& media_source,
xhwang 2015/03/05 22:28:49 Will it work if you have a static Create() functio
Kevin M 2015/03/06 23:12:44 The purpose of this class is more about enforcing
xhwang 2015/03/09 17:37:30 The static Create() function and static member of
Kevin M 2015/03/09 23:32:06 OK, I've turned this class into a "Route ID manage
34 const MediaSinkId& sink_id,
35 const std::string& description,
36 bool is_local);
37
38 private:
39 FRIEND_TEST_ALL_PREFIXES(MediaRouteFactoryTest, Create);
40 friend struct DefaultSingletonTraits<MediaRouteFactory>;
41
42 MediaRouteFactory();
43
44 // Gets the next route ID.
45 std::string NextRouteId();
46
47 // Monotonically increasing ID number.
48 uint64 next_id_;
49
50 DISALLOW_COPY_AND_ASSIGN(MediaRouteFactory);
51 };
52
53 } // namespace media_router
54
55 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698