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