| 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..eb56cafd0938a93142e81102f65103757de3ae59
|
| --- /dev/null
|
| +++ b/chrome/browser/media/router/media_route_response.h
|
| @@ -0,0 +1,59 @@
|
| +// 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, or nullptr if there was an error.
|
| + const MediaRoute* route() const { return route_.get(); }
|
| +
|
| + // Returns the error, or an empty string if the route was created
|
| + // successfully.
|
| + 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
|
| + // of success/failure.
|
| + const RouteRequestId request_id_;
|
| + const scoped_ptr<MediaRoute> route_;
|
| + const std::string error_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MediaRouteResponse);
|
| +};
|
| +
|
| +} // namespace media_router
|
| +
|
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_
|
|
|