| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_android.h" | 5 #include "content/browser/web_contents/web_contents_view_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!native_view) { | 244 if (!native_view) { |
| 245 // Need to clear drag and drop state in blink. | 245 // Need to clear drag and drop state in blink. |
| 246 OnDragEnded(); | 246 OnDragEnded(); |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 | 249 |
| 250 JNIEnv* env = AttachCurrentThread(); | 250 JNIEnv* env = AttachCurrentThread(); |
| 251 ScopedJavaLocalRef<jstring> jtext = | 251 ScopedJavaLocalRef<jstring> jtext = |
| 252 ConvertUTF16ToJavaString(env, drop_data.text.string()); | 252 ConvertUTF16ToJavaString(env, drop_data.text.string()); |
| 253 | 253 |
| 254 native_view->StartDragAndDrop(jtext, | 254 if (!native_view->StartDragAndDrop( |
| 255 gfx::ConvertToJavaBitmap(image.bitmap())); | 255 jtext, gfx::ConvertToJavaBitmap(image.bitmap()))) { |
| 256 // Need to clear drag and drop state in blink. |
| 257 OnDragEnded(); |
| 258 return; |
| 259 } |
| 256 | 260 |
| 257 if (content_view_core_) | 261 if (content_view_core_) |
| 258 content_view_core_->HidePopupsAndPreserveSelection(); | 262 content_view_core_->HidePopupsAndPreserveSelection(); |
| 259 } | 263 } |
| 260 | 264 |
| 261 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) { | 265 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) { |
| 262 // Intentional no-op because Android does not have cursor. | 266 // Intentional no-op because Android does not have cursor. |
| 263 } | 267 } |
| 264 | 268 |
| 265 void WebContentsViewAndroid::OnDragEntered( | 269 void WebContentsViewAndroid::OnDragEntered( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // This is called when we the renderer asks us to take focus back (i.e., it has | 310 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 307 // iterated past the last focusable element on the page). | 311 // iterated past the last focusable element on the page). |
| 308 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 312 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 309 if (web_contents_->GetDelegate() && | 313 if (web_contents_->GetDelegate() && |
| 310 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 314 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 311 return; | 315 return; |
| 312 web_contents_->GetRenderWidgetHostView()->Focus(); | 316 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 313 } | 317 } |
| 314 | 318 |
| 315 } // namespace content | 319 } // namespace content |
| OLD | NEW |