| Index: chrome/browser/media/router/media_route_factory.cc
|
| diff --git a/chrome/browser/media/router/media_route_factory.cc b/chrome/browser/media/router/media_route_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..04e79d8c6b44d6899e9be58d32433f1f6d160e1d
|
| --- /dev/null
|
| +++ b/chrome/browser/media/router/media_route_factory.cc
|
| @@ -0,0 +1,36 @@
|
| +// 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.
|
| +
|
| +#include "chrome/browser/media/router/media_route_factory.h"
|
| +
|
| +#include "base/memory/singleton.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "chrome/browser/media/router/media_route.h"
|
| +
|
| +namespace media_router {
|
| +namespace {
|
| +const char kRoutePrefix[] = "route-local-";
|
| +} // namespace
|
| +
|
| +MediaRouteFactory::MediaRouteFactory() : next_id_(0) {}
|
| +
|
| +std::string MediaRouteFactory::NextRouteId() {
|
| + return kRoutePrefix + base::Uint64ToString(next_id_++);
|
| +}
|
| +
|
| +// static
|
| +MediaRouteFactory* MediaRouteFactory::GetInstance() {
|
| + return Singleton<MediaRouteFactory>::get();
|
| +}
|
| +
|
| +MediaRoute MediaRouteFactory::Create(const MediaSource& media_source,
|
| + const MediaSinkId& sink_id,
|
| + const std::string& description,
|
| + bool is_local) {
|
| + DCHECK(CalledOnValidThread());
|
| + return MediaRoute(NextRouteId(), media_source, sink_id, description,
|
| + is_local);
|
| +}
|
| +
|
| +} // namespace media_router
|
|
|