Chromium Code Reviews| Index: ui/android/view_android.cc |
| diff --git a/ui/android/view_android.cc b/ui/android/view_android.cc |
| index 6c55a7bf9df724ce0eea47170c138cd146ba2d85..b59414e67cbde08969dc3baa0e03436b7d4e3d6e 100644 |
| --- a/ui/android/view_android.cc |
| +++ b/ui/android/view_android.cc |
| @@ -7,14 +7,17 @@ |
| #include <algorithm> |
| #include "base/android/jni_android.h" |
| +#include "base/android/jni_string.h" |
| #include "cc/layers/layer.h" |
| #include "jni/ViewAndroidDelegate_jni.h" |
| #include "ui/android/window_android.h" |
| #include "ui/display/display.h" |
| #include "ui/display/screen.h" |
| +#include "url/gurl.h" |
| namespace ui { |
| +using base::android::ConvertUTF8ToJavaString; |
| using base::android::JavaRef; |
| using base::android::ScopedJavaLocalRef; |
| @@ -181,8 +184,59 @@ bool ViewAndroid::StartDragAndDrop(const JavaRef<jstring>& jtext, |
| if (delegate.is_null()) |
| return false; |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| - return Java_ViewAndroidDelegate_startDragAndDrop(env, delegate, jtext, |
| + return Java_ViewAndroidDelegate_startDragAndDrop(env, |
| + delegate, |
| + jtext, |
| jimage); |
| } |
| +void ViewAndroid::OnBackgroundColorChanged(unsigned int color) { |
| + ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| + if (delegate.is_null()) |
| + return; |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + return Java_ViewAndroidDelegate_onBackgroundColorChanged(env, |
|
boliu
2017/02/07 21:47:06
not return for void methods
Jinsuk Kim
2017/02/07 23:51:04
Done. Interesting the compiler does't complain...
|
| + delegate, |
| + color); |
| +} |
| + |
| +void ViewAndroid::OnTopControlsChanged(float top_controls_offset, |
| + float top_content_offset) { |
| + ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| + if (delegate.is_null()) |
| + return; |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + return Java_ViewAndroidDelegate_onTopControlsChanged(env, |
| + delegate, |
| + top_controls_offset, |
| + top_content_offset); |
| +} |
| + |
| +void ViewAndroid::OnBottomControlsChanged(float bottom_controls_offset, |
| + float bottom_content_offset) { |
| + ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| + if (delegate.is_null()) |
| + return; |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + return Java_ViewAndroidDelegate_onBottomControlsChanged( |
| + env, |
| + delegate, |
| + bottom_controls_offset, |
| + bottom_content_offset); |
| +} |
| + |
| +void ViewAndroid::StartContentIntent(const GURL& content_url, |
| + bool is_main_frame) { |
| + ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| + if (delegate.is_null()) |
| + return; |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + ScopedJavaLocalRef<jstring> jcontent_url = |
| + ConvertUTF8ToJavaString(env, content_url.spec()); |
| + return Java_ViewAndroidDelegate_onStartContentIntent(env, |
| + delegate, |
| + jcontent_url, |
| + is_main_frame); |
| + |
| +} |
| } // namespace ui |