Index: media/screen_capture/android/screen_capture_factory_android.cc |
diff --git a/media/screen_capture/android/screen_capture_factory_android.cc b/media/screen_capture/android/screen_capture_factory_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5912f55d75291e70fc6d1a501de9256960ddebdb |
--- /dev/null |
+++ b/media/screen_capture/android/screen_capture_factory_android.cc |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 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. |
+ |
+#include "media/screen_capture/android/screen_capture_factory_android.h" |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "jni/ScreenCaptureFactory_jni.h" |
+#include "media/screen_capture/android/screen_capturer2_android.h" |
+ |
+using base::android::AttachCurrentThread; |
+using base::android::ScopedJavaLocalRef; |
+ |
+namespace media { |
+ |
+// static |
+bool ScreenCaptureFactoryAndroid::RegisterScreenCaptureFactory( |
+ JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |
+ |
+//static |
+ScopedJavaLocalRef<jobject> |
+ScreenCaptureFactoryAndroid::createScreenCaptureAndroid( |
+ jlong nativeScreenCapturerAndroid) { |
+ return (Java_ScreenCaptureFactory_createScreenCapture( |
+ AttachCurrentThread(), |
+ base::android::GetApplicationContext(), |
+ nativeScreenCapturerAndroid)); |
+} |
+ |
+//static |
+ScopedJavaLocalRef<jobject> |
+ScreenCaptureFactoryAndroid::createScreenCapture2Android( |
+ jlong nativeScreenCapturer2Android) { |
+ return (Java_ScreenCaptureFactory_createScreenCapture( |
+ AttachCurrentThread(), |
+ base::android::GetApplicationContext(), |
+ nativeScreenCapturer2Android)); |
+} |
+ |
+scoped_ptr<VideoCaptureDevice> ScreenCaptureFactoryAndroid::Create() { |
+ scoped_ptr<ScreenCapturer2Android> screen_capture_device( |
+ new ScreenCapturer2Android()); |
+ |
+ if (screen_capture_device->Init()) |
+ return screen_capture_device.Pass(); |
+ |
+ DLOG(ERROR) << "Error creating Screen Capture Device."; |
+ return scoped_ptr<VideoCaptureDevice>(); |
+} |
+ |
+} // namespace media |