Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: chrome/browser/media/router/media_sink.h

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chunkier CL Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/media_sink.h
diff --git a/chrome/browser/media/router/media_sink.h b/chrome/browser/media/router/media_sink.h
new file mode 100644
index 0000000000000000000000000000000000000000..8aa891e3f0e990f2b0cb40f9d2549b9a2a8d29ab
--- /dev/null
+++ b/chrome/browser/media/router/media_sink.h
@@ -0,0 +1,61 @@
+// Copyright 2014 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_SINK_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_
+
+#include <string>
+
+#include "chrome/browser/media/router/media_route_id.h"
+
+namespace media_router {
+
+typedef std::string MediaSinkId;
+
+// Represents a sink to which media can be routed.
+class MediaSink {
+ public:
+ enum Status {
+ // The sink is currently not associated with any routes.
+ IDLE,
+ // The sink is currently associated with a route.
+ ACTIVE,
+ // The sink has a pending route request.
+ REQUEST_PENDING
+ };
+
+ // |sink_id|: Unique identifier for the MediaSink.
+ // |name|: Descriptive name of the MediaSink.
+ // |route_id|: ID of the media route currently associated with the MediaSink,
+ // if any. If there are none, pass in an empty string.
+ // |status|: Current status of the MediaSink.
+ // |status| is ACTIVE iff |route_id| is non-empty.
+ MediaSink(const MediaSinkId& sink_id,
+ const std::string& name,
+ const MediaRouteId& route_id,
+ Status status);
+ ~MediaSink();
+
+ const MediaSinkId& sink_id() const { return sink_id_; }
+ const std::string& name() const { return name_; }
+ Status status() const { return status_; }
+ std::string StatusAsString() const;
+
+ // Returns an empty string if there is no route associated with the sink.
+ const MediaRouteId& route_id() const { return route_id_; }
+ bool HasRoute() const;
+
+ bool operator==(const MediaSink& other) const;
+ bool operator!=(const MediaSink& other) const;
+
+ private:
+ MediaSinkId sink_id_;
+ std::string name_;
+ MediaRouteId route_id_;
+ Status status_;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_

Powered by Google App Engine
This is Rietveld 408576698