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

Side by Side 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: move MRPMH::Delegate inheritence from MR to MRImpl Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/media/router/media_route.h"
12
13 namespace media_router {
14
15 // Response to a media route request to the Media Route Provider.
16 class MediaRouteResponse {
17 public:
18 // Creates a MediaRouteResponse object that indicates success.
19 // |request_id|: ID of original request.
20 // |route|: Route created.
21 static scoped_ptr<MediaRouteResponse> Success(
22 const RouteRequestId& request_id,
23 const MediaRoute& route);
24 // Creates a MediaRouteResponse object that indicates failure.
25 // |request_id|: ID of original request.
26 // |error|: Failure reason.
27 static scoped_ptr<MediaRouteResponse> Error(const RouteRequestId& request_id,
28 const std::string& error);
29
30 ~MediaRouteResponse();
31
32 const RouteRequestId& request_id() const { return request_id_; }
33 // Returns a pointer to the route created. Returns nullptr if response
34 // indicates error.
35 const MediaRoute* route() const { return route_.get(); }
Kevin M 2015/03/26 20:50:14 Return const reference instead? See comment below.
imcheng 2015/03/26 23:33:12 Chatted offline. Done.
36 const std::string& error() const { return error_; }
37
38 private:
39 MediaRouteResponse(const RouteRequestId& request_id, const MediaRoute& route);
40 MediaRouteResponse(const RouteRequestId& request_id,
41 const std::string& error);
42 MediaRouteResponse(const MediaRouteResponse& other);
43
44 // ID of original request. Set in all MediaRouteResponse objects, regardless
45 // of success/failure.
46 const RouteRequestId request_id_;
47 // The route created as a result of the request. Points to a valid MediaRoute
48 // iff the response indicates success, nullptr otherwise.
49 const scoped_ptr<MediaRoute> route_;
Kevin M 2015/03/26 20:50:14 How about just putting a MediaRoute here, instead
imcheng 2015/03/26 23:33:13 Done.
50 // Set to empty string if response indicates success, otherwise set to the
51 // failure reason.
52 const std::string error_;
53 };
54
55 } // namespace media_router
56
57 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698