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

Side by Side Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2242173005: End the drag and drop operation properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (content_view_core_) 227 if (content_view_core_)
228 content_view_core_->HideSelectPopupMenu(); 228 content_view_core_->HideSelectPopupMenu();
229 } 229 }
230 230
231 void WebContentsViewAndroid::StartDragging( 231 void WebContentsViewAndroid::StartDragging(
232 const DropData& drop_data, 232 const DropData& drop_data,
233 blink::WebDragOperationsMask allowed_ops, 233 blink::WebDragOperationsMask allowed_ops,
234 const gfx::ImageSkia& image, 234 const gfx::ImageSkia& image,
235 const gfx::Vector2d& image_offset, 235 const gfx::Vector2d& image_offset,
236 const DragEventSourceInfo& event_info) { 236 const DragEventSourceInfo& event_info) {
237 if (drop_data.text.is_null()) 237 if (drop_data.text.is_null()) {
238 // Need to clear drag and drop state in blink.
239 OnDragEnded();
238 return; 240 return;
241 }
239 242
240 gfx::NativeView native_view = GetNativeView(); 243 gfx::NativeView native_view = GetNativeView();
241 if (!native_view) 244 if (!native_view) {
245 // Need to clear drag and drop state in blink.
246 OnDragEnded();
242 return; 247 return;
248 }
243 249
244 JNIEnv* env = AttachCurrentThread(); 250 JNIEnv* env = AttachCurrentThread();
245 ScopedJavaLocalRef<jstring> jtext = 251 ScopedJavaLocalRef<jstring> jtext =
246 ConvertUTF16ToJavaString(env, drop_data.text.string()); 252 ConvertUTF16ToJavaString(env, drop_data.text.string());
247 253
248 native_view->StartDragAndDrop(jtext, 254 native_view->StartDragAndDrop(jtext,
249 gfx::ConvertToJavaBitmap(image.bitmap())); 255 gfx::ConvertToJavaBitmap(image.bitmap()));
250 256
251 if (content_view_core_) 257 if (content_view_core_)
252 content_view_core_->HidePopupsAndPreserveSelection(); 258 content_view_core_->HidePopupsAndPreserveSelection();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // This is called when we the renderer asks us to take focus back (i.e., it has 306 // This is called when we the renderer asks us to take focus back (i.e., it has
301 // iterated past the last focusable element on the page). 307 // iterated past the last focusable element on the page).
302 void WebContentsViewAndroid::TakeFocus(bool reverse) { 308 void WebContentsViewAndroid::TakeFocus(bool reverse) {
303 if (web_contents_->GetDelegate() && 309 if (web_contents_->GetDelegate() &&
304 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 310 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
305 return; 311 return;
306 web_contents_->GetRenderWidgetHostView()->Focus(); 312 web_contents_->GetRenderWidgetHostView()->Focus();
307 } 313 }
308 314
309 } // namespace content 315 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698