| 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 #include "chrome/browser/media/android/router/media_router_android.h" | 5 #include "chrome/browser/media/android/router/media_router_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return nullptr; | 71 return nullptr; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void MediaRouterAndroid::CreateRoute( | 74 void MediaRouterAndroid::CreateRoute( |
| 75 const MediaSource::Id& source_id, | 75 const MediaSource::Id& source_id, |
| 76 const MediaSink::Id& sink_id, | 76 const MediaSink::Id& sink_id, |
| 77 const GURL& origin, | 77 const GURL& origin, |
| 78 content::WebContents* web_contents, | 78 content::WebContents* web_contents, |
| 79 const std::vector<MediaRouteResponseCallback>& callbacks, | 79 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 80 base::TimeDelta timeout, | 80 base::TimeDelta timeout, |
| 81 bool off_the_record) { | 81 bool incognito) { |
| 82 // TODO(avayvod): Implement timeouts (crbug.com/583036). | 82 // TODO(avayvod): Implement timeouts (crbug.com/583036). |
| 83 if (!origin.is_valid()) { | 83 if (!origin.is_valid()) { |
| 84 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( | 84 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( |
| 85 "Invalid origin", RouteRequestResult::INVALID_ORIGIN); | 85 "Invalid origin", RouteRequestResult::INVALID_ORIGIN); |
| 86 for (const MediaRouteResponseCallback& callback : callbacks) | 86 for (const MediaRouteResponseCallback& callback : callbacks) |
| 87 callback.Run(*result); | 87 callback.Run(*result); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string presentation_id = MediaRouterBase::CreatePresentationId(); | 91 std::string presentation_id = MediaRouterBase::CreatePresentationId(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 route_request_id); | 127 route_request_id); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void MediaRouterAndroid::ConnectRouteByRouteId( | 130 void MediaRouterAndroid::ConnectRouteByRouteId( |
| 131 const MediaSource::Id& source, | 131 const MediaSource::Id& source, |
| 132 const MediaRoute::Id& route_id, | 132 const MediaRoute::Id& route_id, |
| 133 const GURL& origin, | 133 const GURL& origin, |
| 134 content::WebContents* web_contents, | 134 content::WebContents* web_contents, |
| 135 const std::vector<MediaRouteResponseCallback>& callbacks, | 135 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 136 base::TimeDelta timeout, | 136 base::TimeDelta timeout, |
| 137 bool off_the_record) { | 137 bool incognito) { |
| 138 NOTIMPLEMENTED(); | 138 NOTIMPLEMENTED(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void MediaRouterAndroid::JoinRoute( | 141 void MediaRouterAndroid::JoinRoute( |
| 142 const MediaSource::Id& source_id, | 142 const MediaSource::Id& source_id, |
| 143 const std::string& presentation_id, | 143 const std::string& presentation_id, |
| 144 const GURL& origin, | 144 const GURL& origin, |
| 145 content::WebContents* web_contents, | 145 content::WebContents* web_contents, |
| 146 const std::vector<MediaRouteResponseCallback>& callbacks, | 146 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 147 base::TimeDelta timeout, | 147 base::TimeDelta timeout, |
| 148 bool off_the_record) { | 148 bool incognito) { |
| 149 // TODO(avayvod): Implement timeouts (crbug.com/583036). | 149 // TODO(avayvod): Implement timeouts (crbug.com/583036). |
| 150 if (!origin.is_valid()) { | 150 if (!origin.is_valid()) { |
| 151 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( | 151 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( |
| 152 "Invalid origin", RouteRequestResult::INVALID_ORIGIN); | 152 "Invalid origin", RouteRequestResult::INVALID_ORIGIN); |
| 153 for (const MediaRouteResponseCallback& callback : callbacks) | 153 for (const MediaRouteResponseCallback& callback : callbacks) |
| 154 callback.Run(*result); | 154 callback.Run(*result); |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 | 157 |
| 158 int tab_id = -1; | 158 int tab_id = -1; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 std::unique_ptr<content::PresentationSessionMessage> message( | 482 std::unique_ptr<content::PresentationSessionMessage> message( |
| 483 new content::PresentationSessionMessage(content::TEXT)); | 483 new content::PresentationSessionMessage(content::TEXT)); |
| 484 message->message = ConvertJavaStringToUTF8(env, jmessage); | 484 message->message = ConvertJavaStringToUTF8(env, jmessage); |
| 485 session_messages.push_back(std::move(message)); | 485 session_messages.push_back(std::move(message)); |
| 486 | 486 |
| 487 FOR_EACH_OBSERVER(PresentationSessionMessagesObserver, *observer_list, | 487 FOR_EACH_OBSERVER(PresentationSessionMessagesObserver, *observer_list, |
| 488 OnMessagesReceived(session_messages, true)); | 488 OnMessagesReceived(session_messages, true)); |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace media_router | 491 } // namespace media_router |
| OLD | NEW |