Index: chrome/browser/media/router/media_route_factory.h |
diff --git a/chrome/browser/media/router/media_route_factory.h b/chrome/browser/media/router/media_route_factory.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..22ff7e8d27072af8c8b4e3349339699659ccc436 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_route_factory.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_ |
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/gtest_prod_util.h" |
+#include "base/memory/singleton.h" |
+#include "base/threading/non_thread_safe.h" |
+#include "chrome/browser/media/router/media_sink.h" |
+#include "chrome/browser/media/router/media_source.h" |
+ |
+namespace media_router { |
+ |
+struct MediaRoute; |
+ |
+// Shared singleton which coordinates the assignment of unique IDs to |
+// MediaRoute objects. |
+class MediaRouteFactory : public base::NonThreadSafe { |
+ public: |
+ static MediaRouteFactory* GetInstance(); |
+ |
+ // Returns a MediaRoute object with a unique ID. |
+ // |type|: Type of media route. |
xhwang
2015/03/09 17:37:31
There's no |type| in the signature.
Kevin M
2015/03/09 23:32:06
Done.
|
+ // |media_source|: Description of source of the route. |
+ // |sink_id|: ID of the MediaSink of the route. |
+ // |description|: Description of the route to be displayed. |
+ // |is_local|: true if the route was created from this browser. |
+ MediaRoute Create(const MediaSource& media_source, |
+ const MediaSinkId& sink_id, |
xhwang
2015/03/09 17:37:31
OOC, can this be a MediaSink instead of a MediaSin
Kevin M
2015/03/09 23:32:06
Done.
|
+ const std::string& description, |
+ bool is_local); |
+ |
+ private: |
+ FRIEND_TEST_ALL_PREFIXES(MediaRouteFactoryTest, Create); |
xhwang
2015/03/09 17:37:31
MediaRouteFactoryTest is not using any private met
Kevin M
2015/03/09 23:32:06
Done.
|
+ friend struct DefaultSingletonTraits<MediaRouteFactory>; |
+ |
+ MediaRouteFactory(); |
+ |
+ // Gets the next route ID. |
+ std::string NextRouteId(); |
+ |
+ // Monotonically increasing ID number. |
+ uint64 next_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MediaRouteFactory); |
+}; |
+ |
+} // namespace media_router |
+ |
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_FACTORY_H_ |