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 #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 "chrome/browser/media/router/media_sink.h" | |
14 #include "chrome/browser/media/router/media_source.h" | |
15 | |
16 namespace media_router { | |
17 | |
18 class MediaRoute; | |
19 | |
20 // Shared singleton which coordinates the assignment of unique IDs to | |
21 // MediaRoute objects. | |
mark a. foltz
2015/03/05 16:58:41
This is a static singleton that uses a non-threads
Kevin M
2015/03/05 18:34:18
Done.
| |
22 class MediaRouteFactory { | |
23 public: | |
24 static MediaRouteFactory* GetInstance(); | |
25 | |
26 // Returns a MediaRoute object with a unique ID. | |
27 // |type|: Type of media route. | |
28 // |media_source|: Description of source of the route. | |
29 // |sink_id|: ID of the MediaSink of the route. | |
30 // |description|: Description of the route to be displayed. | |
31 // |is_local|: true if the route was created from this browser. | |
32 MediaRoute Create(const MediaSource& media_source, | |
33 const MediaSinkId& sink_id, | |
34 const std::string& description, | |
35 bool is_local); | |
36 | |
37 private: | |
38 FRIEND_TEST_ALL_PREFIXES(MediaRouteFactoryTest, Create); | |
39 friend struct DefaultSingletonTraits<MediaRouteFactory>; | |
40 | |
41 MediaRouteFactory(); | |
42 | |
43 // Gets the next route ID. | |
44 std::string NextRouteId(); | |
45 | |
46 // Monotonically increasing ID number. | |
47 uint64 next_id_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(MediaRouteFactory); | |
50 }; | |
51 | |
52 } // namespace media_router | |
53 | |
54 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_ | |
OLD | NEW |