Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: chrome/browser/media/android/router/media_router_android.cc

Issue 2720273003: [Media Router] Remove binary messaging implementation. (Closed)
Patch Set: Apply suggested patch Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MockMediaRouteProvider.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ScopedJavaLocalRef<jstring> jmessage = 177 ScopedJavaLocalRef<jstring> jmessage =
178 base::android::ConvertUTF8ToJavaString(env, message); 178 base::android::ConvertUTF8ToJavaString(env, message);
179 Java_ChromeMediaRouter_sendStringMessage(env, java_media_router_, jroute_id, 179 Java_ChromeMediaRouter_sendStringMessage(env, java_media_router_, jroute_id,
180 jmessage, callback_id); 180 jmessage, callback_id);
181 } 181 }
182 182
183 void MediaRouterAndroid::SendRouteBinaryMessage( 183 void MediaRouterAndroid::SendRouteBinaryMessage(
184 const MediaRoute::Id& route_id, 184 const MediaRoute::Id& route_id,
185 std::unique_ptr<std::vector<uint8_t>> data, 185 std::unique_ptr<std::vector<uint8_t>> data,
186 const SendRouteMessageCallback& callback) { 186 const SendRouteMessageCallback& callback) {
187 int callback_id = message_callbacks_.Add( 187 // Binary messaging is not supported on Android.
188 base::MakeUnique<SendRouteMessageCallback>(callback)); 188 callback.Run(false);
189 JNIEnv* env = base::android::AttachCurrentThread();
190 ScopedJavaLocalRef<jstring> jroute_id =
191 base::android::ConvertUTF8ToJavaString(env, route_id);
192 ScopedJavaLocalRef<jbyteArray> jbyte_array =
193 base::android::ToJavaByteArray(env, &((*data)[0]), data->size());
194 Java_ChromeMediaRouter_sendBinaryMessage(env, java_media_router_, jroute_id,
195 jbyte_array, callback_id);
196 } 189 }
197 190
198 void MediaRouterAndroid::AddIssue(const IssueInfo& issue_info) { 191 void MediaRouterAndroid::AddIssue(const IssueInfo& issue_info) {
199 NOTIMPLEMENTED(); 192 NOTIMPLEMENTED();
200 } 193 }
201 194
202 void MediaRouterAndroid::ClearIssue(const Issue::Id& issue_id) { 195 void MediaRouterAndroid::ClearIssue(const Issue::Id& issue_id) {
203 NOTIMPLEMENTED(); 196 NOTIMPLEMENTED();
204 } 197 }
205 198
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return; 431 return;
439 432
440 std::vector<RouteMessage> messages(1); 433 std::vector<RouteMessage> messages(1);
441 messages.front().type = RouteMessage::TEXT; 434 messages.front().type = RouteMessage::TEXT;
442 messages.front().text = ConvertJavaStringToUTF8(env, jmessage); 435 messages.front().text = ConvertJavaStringToUTF8(env, jmessage);
443 for (auto& observer : *it->second.get()) 436 for (auto& observer : *it->second.get())
444 observer.OnMessagesReceived(messages); 437 observer.OnMessagesReceived(messages);
445 } 438 }
446 439
447 } // namespace media_router 440 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MockMediaRouteProvider.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698