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

Side by Side Diff: chrome/browser/media/router/create_presentation_connection_request.h

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 // Holds parameters for creating a presentation session. 27 // Holds parameters for creating a presentation session.
28 // A request object is created by presentation_service_delegate_impl when it 28 // A request object is created by presentation_service_delegate_impl when it
29 // gets create-session request. The object is then passed to and owned by the 29 // gets create-session request. The object is then passed to and owned by the
30 // MediaRouterUI. |success_cb| will be invoked when create-session 30 // MediaRouterUI. |success_cb| will be invoked when create-session
31 // succeeds, or |error_cb| will be invoked when create-session fails or 31 // succeeds, or |error_cb| will be invoked when create-session fails or
32 // the UI closes. 32 // the UI closes.
33 class CreatePresentationConnectionRequest { 33 class CreatePresentationConnectionRequest {
34 public: 34 public:
35 using PresentationSessionSuccessCallback = 35 using PresentationSessionSuccessCallback =
36 base::Callback<void(const content::PresentationSessionInfo&, 36 base::Callback<void(const content::PresentationSessionInfo&,
37 const MediaRoute::Id&)>; 37 const MediaRoute&)>;
38 using PresentationSessionErrorCallback = 38 using PresentationSessionErrorCallback =
39 content::PresentationSessionErrorCallback; 39 content::PresentationSessionErrorCallback;
40 // |presentation_url|: The presentation URL of the request. Must be a valid 40 // |presentation_url|: The presentation URL of the request. Must be a valid
41 // URL. 41 // URL.
42 // |frame_url|: The URL of the frame that initiated the presentation request. 42 // |frame_url|: The URL of the frame that initiated the presentation request.
43 // |success_cb|: Callback to invoke when the request succeeds. Must be valid. 43 // |success_cb|: Callback to invoke when the request succeeds. Must be valid.
44 // |erorr_cb|: Callback to invoke when the request fails. Must be valid. 44 // |erorr_cb|: Callback to invoke when the request fails. Must be valid.
45 CreatePresentationConnectionRequest( 45 CreatePresentationConnectionRequest(
46 const RenderFrameHostId& render_frame_host_id, 46 const RenderFrameHostId& render_frame_host_id,
47 const std::string& presentation_url, 47 const std::string& presentation_url,
48 const GURL& frame_url, 48 const GURL& frame_url,
49 const PresentationSessionSuccessCallback& success_cb, 49 const PresentationSessionSuccessCallback& success_cb,
50 const PresentationSessionErrorCallback& error_cb); 50 const PresentationSessionErrorCallback& error_cb);
51 ~CreatePresentationConnectionRequest(); 51 ~CreatePresentationConnectionRequest();
52 52
53 const PresentationRequest& presentation_request() const { 53 const PresentationRequest& presentation_request() const {
54 return presentation_request_; 54 return presentation_request_;
55 } 55 }
56 56
57 // Invokes |success_cb_| or |error_cb_| with the given arguments. 57 // Invokes |success_cb_| or |error_cb_| with the given arguments.
58 // These functions can only be invoked once per instance. It is an error 58 // These functions can only be invoked once per instance. It is an error
59 // to invoke these functions more than once. 59 // to invoke these functions more than once.
60 void InvokeSuccessCallback(const std::string& presentation_id, 60 void InvokeSuccessCallback(const std::string& presentation_id,
61 const MediaRoute::Id& route_id); 61 const MediaRoute& route);
62 void InvokeErrorCallback(const content::PresentationError& error); 62 void InvokeErrorCallback(const content::PresentationError& error);
63 63
64 // Handle route creation/joining response by invoking the right callback. 64 // Handle route creation/joining response by invoking the right callback.
65 static void HandleRouteResponse( 65 static void HandleRouteResponse(
66 std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, 66 std::unique_ptr<CreatePresentationConnectionRequest> presentation_request,
67 const RouteRequestResult& result); 67 const RouteRequestResult& result);
68 68
69 private: 69 private:
70 const PresentationRequest presentation_request_; 70 const PresentationRequest presentation_request_;
71 PresentationSessionSuccessCallback success_cb_; 71 PresentationSessionSuccessCallback success_cb_;
72 PresentationSessionErrorCallback error_cb_; 72 PresentationSessionErrorCallback error_cb_;
73 bool cb_invoked_; 73 bool cb_invoked_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); 75 DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest);
76 }; 76 };
77 77
78 } // namespace media_router 78 } // namespace media_router
79 79
80 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ 80 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698