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..52ee644688272a841d8a1035ae571bfff1b039be |
--- /dev/null |
+++ b/chrome/browser/media/router/media_route_factory.h |
@@ -0,0 +1,54 @@ |
+// 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 "chrome/browser/media/router/media_sink.h" |
+#include "chrome/browser/media/router/media_source.h" |
+ |
+namespace media_router { |
+ |
+class MediaRoute; |
+ |
+// Shared singleton which coordinates the assignment of unique IDs to |
+// MediaRoute objects. |
+class MediaRouteFactory { |
+ public: |
+ static MediaRouteFactory* GetInstance(); |
+ |
+ // Creates a MediaRoute object with a unique ID. |
+ // |type|: Type of media route. |
+ // |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, |
imcheng
2015/03/03 22:53:10
I think the fact that this returns a dynamically a
Kevin M
2015/03/03 23:28:05
Done.
mark a. foltz
2015/03/04 06:22:59
Doesn't look that way from my diff.
Kevin M
2015/03/04 23:33:32
I neglected to git cl upload. Sorry.
|
+ const MediaSinkId& sink_id, |
+ const std::string& description, |
+ bool is_local); |
+ |
+ private: |
+ FRIEND_TEST_ALL_PREFIXES(MediaRouteFactoryTest, Create); |
+ 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_ |