| 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  |  10  | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|  39                           const MediaRoute::Id&)>; |  39                           const MediaRoute::Id&)>; | 
|  40   using PresentationSessionErrorCallback = |  40   using PresentationSessionErrorCallback = | 
|  41       content::PresentationSessionErrorCallback; |  41       content::PresentationSessionErrorCallback; | 
|  42   // |presentation_url|: The presentation URL of the request. Must be a valid |  42   // |presentation_url|: The presentation URL of the request. Must be a valid | 
|  43   //                     URL. |  43   //                     URL. | 
|  44   // |frame_url|: The URL of the frame that initiated the presentation request. |  44   // |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. |  45   // |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. |  46   // |erorr_cb|: Callback to invoke when the request fails. Must be valid. | 
|  47   CreatePresentationConnectionRequest( |  47   CreatePresentationConnectionRequest( | 
|  48       const RenderFrameHostId& render_frame_host_id, |  48       const RenderFrameHostId& render_frame_host_id, | 
|  49       const GURL& presentation_url, |  49       const vector<GURL>& presentation_urls, | 
|  50       const GURL& frame_url, |  50       const GURL& frame_url, | 
|  51       const PresentationSessionSuccessCallback& success_cb, |  51       const PresentationSessionSuccessCallback& success_cb, | 
|  52       const PresentationSessionErrorCallback& error_cb); |  52       const PresentationSessionErrorCallback& error_cb); | 
|  53   ~CreatePresentationConnectionRequest(); |  53   ~CreatePresentationConnectionRequest(); | 
|  54  |  54  | 
|  55   const PresentationRequest& presentation_request() const { |  55   const PresentationRequest& presentation_request() const { | 
|  56     return presentation_request_; |  56     return presentation_request_; | 
|  57   } |  57   } | 
|  58  |  58  | 
|  59   // Invokes |success_cb_| or |error_cb_| with the given arguments. |  59   // Invokes |success_cb_| or |error_cb_| with the given arguments. | 
|  60   // These functions can only be invoked once per instance. It is an error |  60   // These functions can only be invoked once per instance. It is an error | 
|  61   // to invoke these functions more than once. |  61   // to invoke these functions more than once. | 
|  62   void InvokeSuccessCallback(const std::string& presentation_id, |  62   void InvokeSuccessCallback(const std::string& presentation_id, | 
 |  63                              const GURL& presentation_url, | 
|  63                              const MediaRoute::Id& route_id); |  64                              const MediaRoute::Id& route_id); | 
|  64   void InvokeErrorCallback(const content::PresentationError& error); |  65   void InvokeErrorCallback(const content::PresentationError& error); | 
|  65  |  66  | 
|  66   // Handle route creation/joining response by invoking the right callback. |  67   // Handle route creation/joining response by invoking the right callback. | 
|  67   static void HandleRouteResponse( |  68   static void HandleRouteResponse( | 
|  68       std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, |  69       std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, | 
|  69       const RouteRequestResult& result); |  70       const RouteRequestResult& result); | 
|  70  |  71  | 
|  71  private: |  72  private: | 
|  72   const PresentationRequest presentation_request_; |  73   const PresentationRequest presentation_request_; | 
|  73   PresentationSessionSuccessCallback success_cb_; |  74   PresentationSessionSuccessCallback success_cb_; | 
|  74   PresentationSessionErrorCallback error_cb_; |  75   PresentationSessionErrorCallback error_cb_; | 
|  75   bool cb_invoked_; |  76   bool cb_invoked_; | 
|  76  |  77  | 
|  77   DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); |  78   DISALLOW_COPY_AND_ASSIGN(CreatePresentationConnectionRequest); | 
|  78 }; |  79 }; | 
|  79  |  80  | 
|  80 }  // namespace media_router |  81 }  // namespace media_router | 
|  81  |  82  | 
|  82 #endif  // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ |  83 #endif  // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_CONNECTION_REQUEST_H_ | 
| OLD | NEW |