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

Unified Diff: media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java

Issue 10961015: Android: MediaPlayerBridge JNI cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java
diff --git a/media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java b/media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java
new file mode 100644
index 0000000000000000000000000000000000000000..13442e6dfe8f989322dd1ba9df069a6f4eb5815a
--- /dev/null
+++ b/media/base/android/java/src/org/chromium/media/MediaPlayerBridge.java
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.media;
+
+import android.content.Context;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.text.TextUtils;
+
+import java.util.HashMap;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+@JNINamespace("media")
+class MediaPlayerBridge {
+ @CalledByNative
+ private static boolean setDataSource(MediaPlayer player, Context context, String url,
+ String cookies, boolean hideUrlLog) {
+ Uri uri = Uri.parse(url);
+ HashMap headersMap = new HashMap<String, String>();
+ if (hideUrlLog)
+ headersMap.put("x-hide-urls-from-log", "true");
+ if (!TextUtils.isEmpty(cookies))
+ headersMap.put("Cookie", cookies);
+ try {
+ player.setDataSource(context, uri, headersMap);
scherkus (not reviewing) 2012/09/20 19:13:55 should these be 4 space indent?
bulach 2012/09/21 10:10:26 Done.
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698