| OLD | NEW |
| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/media/router/media_route.h" | 13 #include "chrome/browser/media/router/media_route.h" |
| 14 #include "chrome/browser/media/router/media_source.h" | 14 #include "chrome/browser/media/router/media_source.h" |
| 15 #include "chrome/browser/media/router/presentation_request.h" | 15 #include "chrome/browser/media/router/presentation_request.h" |
| 16 #include "chrome/browser/media/router/render_frame_host_id.h" | 16 #include "chrome/browser/media/router/render_frame_host_id.h" |
| 17 #include "content/public/browser/presentation_service_delegate.h" | 17 #include "content/public/browser/presentation_service_delegate.h" |
| 18 | 18 |
| 19 class GURL; |
| 20 |
| 19 namespace content { | 21 namespace content { |
| 20 struct PresentationError; | 22 struct PresentationError; |
| 21 struct PresentationSessionInfo; | 23 struct PresentationSessionInfo; |
| 22 } // namespace content | 24 } // namespace content |
| 23 | 25 |
| 24 namespace url { | |
| 25 class Origin; | |
| 26 } // namespace url | |
| 27 | |
| 28 namespace media_router { | 26 namespace media_router { |
| 29 | 27 |
| 30 class RouteRequestResult; | 28 class RouteRequestResult; |
| 31 | 29 |
| 32 // Holds parameters for creating a presentation session. | 30 // Holds parameters for creating a presentation session. |
| 33 // A request object is created by presentation_service_delegate_impl when it | 31 // A request object is created by presentation_service_delegate_impl when it |
| 34 // gets create-session request. The object is then passed to and owned by the | 32 // gets create-session request. The object is then passed to and owned by the |
| 35 // MediaRouterUI. |success_cb| will be invoked when create-session | 33 // MediaRouterUI. |success_cb| will be invoked when create-session |
| 36 // succeeds, or |error_cb| will be invoked when create-session fails or | 34 // succeeds, or |error_cb| will be invoked when create-session fails or |
| 37 // the UI closes. | 35 // the UI closes. |
| 38 class CreatePresentationConnectionRequest { | 36 class CreatePresentationConnectionRequest { |
| 39 public: | 37 public: |
| 40 using PresentationSessionSuccessCallback = | 38 using PresentationSessionSuccessCallback = |
| 41 base::Callback<void(const content::PresentationSessionInfo&, | 39 base::Callback<void(const content::PresentationSessionInfo&, |
| 42 const MediaRoute&)>; | 40 const MediaRoute&)>; |
| 43 using PresentationSessionErrorCallback = | 41 using PresentationSessionErrorCallback = |
| 44 content::PresentationSessionErrorCallback; | 42 content::PresentationSessionErrorCallback; |
| 45 // |presentation_url|: The presentation URL of the request. Must be a valid | 43 // |presentation_url|: The presentation URL of the request. Must be a valid |
| 46 // URL. | 44 // URL. |
| 47 // |frame_origin|: The origin of the frame that initiated the presentation | 45 // |frame_url|: The URL of the frame that initiated the presentation request. |
| 48 // request. | |
| 49 // |success_cb|: Callback to invoke when the request succeeds. Must be valid. | 46 // |success_cb|: Callback to invoke when the request succeeds. Must be valid. |
| 50 // |erorr_cb|: Callback to invoke when the request fails. Must be valid. | 47 // |erorr_cb|: Callback to invoke when the request fails. Must be valid. |
| 51 CreatePresentationConnectionRequest( | 48 CreatePresentationConnectionRequest( |
| 52 const RenderFrameHostId& render_frame_host_id, | 49 const RenderFrameHostId& render_frame_host_id, |
| 53 const std::vector<GURL>& presentation_urls, | 50 const std::vector<GURL>& presentation_urls, |
| 54 const url::Origin& frame_origin, | 51 const GURL& frame_url, |
| 55 const PresentationSessionSuccessCallback& success_cb, | 52 const PresentationSessionSuccessCallback& success_cb, |
| 56 const PresentationSessionErrorCallback& error_cb); | 53 const PresentationSessionErrorCallback& error_cb); |
| 57 ~CreatePresentationConnectionRequest(); | 54 ~CreatePresentationConnectionRequest(); |
| 58 | 55 |
| 59 const PresentationRequest& presentation_request() const { | 56 const PresentationRequest& presentation_request() const { |
| 60 return presentation_request_; | 57 return presentation_request_; |
| 61 } | 58 } |
| 62 | 59 |
| 63 // Invokes |success_cb_| or |error_cb_| with the given arguments. | 60 // Invokes |success_cb_| or |error_cb_| with the given arguments. |
| 64 // These functions can only be invoked once per instance. It is an error | 61 // These functions can only be invoked once per instance. It is an error |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 PresentationSessionSuccessCallback success_cb_; | 75 PresentationSessionSuccessCallback success_cb_; |
| 79 PresentationSessionErrorCallback error_cb_; | 76 PresentationSessionErrorCallback error_cb_; |
| 80 bool cb_invoked_; | 77 bool cb_invoked_; |
| 81 | 78 |
| 82 DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); | 79 DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } // namespace media_router | 82 } // namespace media_router |
| 86 | 83 |
| 87 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ | 84 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ |
| OLD | NEW |