| 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  |  11  | 
|  11 #include "base/macros.h" |  12 #include "base/macros.h" | 
|  12 #include "chrome/browser/media/router/media_route.h" |  13 #include "chrome/browser/media/router/media_route.h" | 
|  13 #include "chrome/browser/media/router/media_source.h" |  14 #include "chrome/browser/media/router/media_source.h" | 
|  14 #include "chrome/browser/media/router/presentation_request.h" |  15 #include "chrome/browser/media/router/presentation_request.h" | 
|  15 #include "chrome/browser/media/router/render_frame_host_id.h" |  16 #include "chrome/browser/media/router/render_frame_host_id.h" | 
|  16 #include "content/public/browser/presentation_service_delegate.h" |  17 #include "content/public/browser/presentation_service_delegate.h" | 
|  17  |  18  | 
|  18 class GURL; |  19 class GURL; | 
|  19  |  20  | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  39                           const MediaRoute&)>; |  40                           const MediaRoute&)>; | 
|  40   using PresentationSessionErrorCallback = |  41   using PresentationSessionErrorCallback = | 
|  41       content::PresentationSessionErrorCallback; |  42       content::PresentationSessionErrorCallback; | 
|  42   // |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 | 
|  43   //                     URL. |  44   //                     URL. | 
|  44   // |frame_url|: The URL of the frame that initiated the presentation request. |  45   // |frame_url|: The URL of the frame that initiated the presentation request. | 
|  45   // |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. | 
|  46   // |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. | 
|  47   CreatePresentationConnectionRequest( |  48   CreatePresentationConnectionRequest( | 
|  48       const RenderFrameHostId& render_frame_host_id, |  49       const RenderFrameHostId& render_frame_host_id, | 
|  49       const GURL& presentation_url, |  50       const std::vector<GURL>& presentation_urls, | 
|  50       const GURL& frame_url, |  51       const GURL& frame_url, | 
|  51       const PresentationSessionSuccessCallback& success_cb, |  52       const PresentationSessionSuccessCallback& success_cb, | 
|  52       const PresentationSessionErrorCallback& error_cb); |  53       const PresentationSessionErrorCallback& error_cb); | 
|  53   ~CreatePresentationConnectionRequest(); |  54   ~CreatePresentationConnectionRequest(); | 
|  54  |  55  | 
|  55   const PresentationRequest& presentation_request() const { |  56   const PresentationRequest& presentation_request() const { | 
|  56     return presentation_request_; |  57     return presentation_request_; | 
|  57   } |  58   } | 
|  58  |  59  | 
|  59   // Invokes |success_cb_| or |error_cb_| with the given arguments. |  60   // Invokes |success_cb_| or |error_cb_| with the given arguments. | 
|  60   // 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 | 
|  61   // to invoke these functions more than once. |  62   // to invoke these functions more than once. | 
|  62   void InvokeSuccessCallback(const std::string& presentation_id, |  63   void InvokeSuccessCallback(const std::string& presentation_id, | 
 |  64                              const GURL& presentation_url, | 
|  63                              const MediaRoute& route); |  65                              const MediaRoute& route); | 
|  64   void InvokeErrorCallback(const content::PresentationError& error); |  66   void InvokeErrorCallback(const content::PresentationError& error); | 
|  65  |  67  | 
|  66   // Handle route creation/joining response by invoking the right callback. |  68   // Handle route creation/joining response by invoking the right callback. | 
|  67   static void HandleRouteResponse( |  69   static void HandleRouteResponse( | 
|  68       std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, |  70       std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, | 
|  69       const RouteRequestResult& result); |  71       const RouteRequestResult& result); | 
|  70  |  72  | 
|  71  private: |  73  private: | 
|  72   const PresentationRequest presentation_request_; |  74   const PresentationRequest presentation_request_; | 
|  73   PresentationSessionSuccessCallback success_cb_; |  75   PresentationSessionSuccessCallback success_cb_; | 
|  74   PresentationSessionErrorCallback error_cb_; |  76   PresentationSessionErrorCallback error_cb_; | 
|  75   bool cb_invoked_; |  77   bool cb_invoked_; | 
|  76  |  78  | 
|  77   DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); |  79   DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); | 
|  78 }; |  80 }; | 
|  79  |  81  | 
|  80 }  // namespace media_router |  82 }  // namespace media_router | 
|  81  |  83  | 
|  82 #endif  // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ |  84 #endif  // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ | 
| OLD | NEW |