 Chromium Code Reviews
 Chromium Code Reviews Issue 10916160:
  Upstreaming SelectFileDialog for Android  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 10916160:
  Upstreaming SelectFileDialog for Android  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: ui/gfx/android/window_android.cc | 
| diff --git a/ui/gfx/android/window_android.cc b/ui/gfx/android/window_android.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..9ade2bb02465237589f31fde8110d2552b2b9e37 | 
| --- /dev/null | 
| +++ b/ui/gfx/android/window_android.cc | 
| @@ -0,0 +1,46 @@ | 
| +// 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. | 
| + | 
| +#include "window_android.h" | 
| + | 
| +#include "base/android/jni_android.h" | 
| +#include "base/android/jni_helper.h" | 
| +#include "base/android/scoped_java_ref.h" | 
| +#include "jni/NativeWindow_jni.h" | 
| + | 
| +namespace ui { | 
| + | 
| +using base::android::AttachCurrentThread; | 
| +using base::android::ScopedJavaLocalRef; | 
| + | 
| +WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj) | 
| + : weak_java_window_(env, obj) { | 
| +} | 
| + | 
| +void WindowAndroid::Destroy(JNIEnv* env, jobject obj) { | 
| 
sky
2012/09/17 20:53:44
I'm not familiar with the java side, but how come
 
aurimas (slooooooooow)
2012/09/17 22:20:48
Sadly it cannot do it directly, java has to call t
 | 
| + delete this; | 
| +} | 
| + | 
| +ScopedJavaLocalRef<jobject> WindowAndroid::GetJavaObject() { | 
| + JNIEnv* env = AttachCurrentThread(); | 
| + return weak_java_window_.get(env); | 
| +} | 
| + | 
| +bool WindowAndroid::RegisterWindowAndroid(JNIEnv* env) { | 
| + return RegisterNativesImpl(env); | 
| +} | 
| + | 
| +WindowAndroid::~WindowAndroid() { | 
| +} | 
| + | 
| +// ---------------------------------------------------------------------------- | 
| +// Native JNI methods | 
| +// ---------------------------------------------------------------------------- | 
| + | 
| +jint Init(JNIEnv* env, jobject obj) { | 
| + WindowAndroid* window = new WindowAndroid(env, obj); | 
| + return reinterpret_cast<jint>(window); | 
| +} | 
| + | 
| +} // namespace ui |