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

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

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm dependency on helper function in chrome_browser Created 5 years, 9 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_route_response.h
diff --git a/chrome/browser/media/router/media_route_response.h b/chrome/browser/media/router/media_route_response.h
new file mode 100644
index 0000000000000000000000000000000000000000..d13c435a81905636da078682ef87e700c3df7643
--- /dev/null
+++ b/chrome/browser/media/router/media_route_response.h
@@ -0,0 +1,60 @@
+// 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_RESPONSE_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/media/router/media_route.h"
+
+namespace media_router {
+
+// Response from the media route provider to a media route request.
+class MediaRouteResponse {
+ public:
+ // Creates a MediaRouteResponse object that indicates success.
+ // |request_id|: ID of original request.
+ // |route|: Route created.
+ static scoped_ptr<MediaRouteResponse> CreateFromSuccess(
+ const RouteRequestId& request_id,
+ const MediaRoute& route);
+
+ // Creates a MediaRouteResponse object that indicates failure.
+ // |request_id|: ID of original request.
+ // |error|: Failure reason.
+ static scoped_ptr<MediaRouteResponse> CreateFromError(
+ const RouteRequestId& request_id,
+ const std::string& error);
+
+ ~MediaRouteResponse();
+
+ const RouteRequestId& request_id() const { return request_id_; }
+
+ // Returns the route created. Returns an empty route if response is error.
mark a. foltz 2015/03/31 22:10:24 ...created, or an empty route if there was an erro
imcheng 2015/04/01 00:55:16 Done.
+ const MediaRoute& route() const { return route_; }
+
+ // Returns the error. Returns an empty string if response is success.
mark a. foltz 2015/03/31 22:10:24 error, or an empty string if the route was created
imcheng 2015/04/01 00:55:16 Done.
+ const std::string& error() const { return error_; }
+
+ private:
+ MediaRouteResponse(const RouteRequestId& request_id, const MediaRoute& route);
+ MediaRouteResponse(const RouteRequestId& request_id,
+ const std::string& error);
+
+ // ID of original request. Set in all MediaRouteResponse objects, regardless
mark a. foltz 2015/03/31 22:10:24 Since the documentation in the public API describe
imcheng 2015/04/01 00:55:16 Removed comment son route_ and error_.
+ // of success/failure.
+ const RouteRequestId request_id_;
+ // The route created as a result of the request. Set to a valid MediaRoute
+ // iff the response indicates success, empty MediaRoute otherwise.
+ const MediaRoute route_;
+ // Set to empty string if response indicates success, otherwise set to the
+ // failure reason.
+ const std::string error_;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_

Powered by Google App Engine
This is Rietveld 408576698