Chromium Code Reviews| 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..7672a0ee61352eaa237406a99dd8dec352b9bcd7 |
| --- /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. |
|
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.
|
| +class MediaRouteFactory { |
| + public: |
| + static MediaRouteFactory* GetInstance(); |
| + |
| + // Returns 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, |
| + 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_ |