| 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_SESSION_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_SESSION_REQUEST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_SESSION_REQUEST_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_SESSION_REQUEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/media/router/media_route.h" | 10 #include "chrome/browser/media/router/media_route.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const MediaSource& media_source() const { return media_source_; } | 48 const MediaSource& media_source() const { return media_source_; } |
| 49 const GURL& frame_url() const { return frame_url_; } | 49 const GURL& frame_url() const { return frame_url_; } |
| 50 | 50 |
| 51 // Invokes |success_cb_| or |error_cb_| with the given arguments. | 51 // Invokes |success_cb_| or |error_cb_| with the given arguments. |
| 52 // These functions can only be invoked once per instance. Further invocations | 52 // These functions can only be invoked once per instance. Further invocations |
| 53 // are no-op. | 53 // are no-op. |
| 54 void MaybeInvokeSuccessCallback(const std::string& presentation_id, | 54 void MaybeInvokeSuccessCallback(const std::string& presentation_id, |
| 55 const MediaRoute::Id& route_id); | 55 const MediaRoute::Id& route_id); |
| 56 void MaybeInvokeErrorCallback(const content::PresentationError& error); | 56 void MaybeInvokeErrorCallback(const content::PresentationError& error); |
| 57 | 57 |
| 58 // Handle route creation/joining response by invoking the right callback. |
| 59 static void HandleRouteResponse( |
| 60 scoped_ptr<CreatePresentationSessionRequest> presentation_request, |
| 61 const MediaRoute* route, |
| 62 const std::string& presentation_id, |
| 63 const std::string& error); |
| 64 |
| 58 private: | 65 private: |
| 59 const MediaSource media_source_; | 66 const MediaSource media_source_; |
| 60 const GURL frame_url_; | 67 const GURL frame_url_; |
| 61 PresentationSessionSuccessCallback success_cb_; | 68 PresentationSessionSuccessCallback success_cb_; |
| 62 PresentationSessionErrorCallback error_cb_; | 69 PresentationSessionErrorCallback error_cb_; |
| 63 bool cb_invoked_; | 70 bool cb_invoked_; |
| 64 | 71 |
| 65 DISALLOW_COPY_AND_ASSIGN(CreatePresentationSessionRequest); | 72 DISALLOW_COPY_AND_ASSIGN(CreatePresentationSessionRequest); |
| 66 }; | 73 }; |
| 67 | 74 |
| 68 } // namespace media_router | 75 } // namespace media_router |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_SESSION_REQUEST_H_ | 77 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_PRESENTATION_SESSION_REQUEST_H_ |
| OLD | NEW |