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

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

Issue 2485693003: Drag-and-drop: DragEnter, DragOver, DragLeave, DragDrop (Closed)
Patch Set: Rebased. More fixes. Created 4 years, 1 month 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
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 "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 if (content_view_core_) 299 if (content_view_core_)
300 content_view_core_->HidePopupsAndPreserveSelection(); 300 content_view_core_->HidePopupsAndPreserveSelection();
301 } 301 }
302 302
303 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) { 303 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) {
304 // Intentional no-op because Android does not have cursor. 304 // Intentional no-op because Android does not have cursor.
305 } 305 }
306 306
307 // TODO(paulmeyer): The drag-and-drop calls on GetRenderViewHost()->GetWidget()
308 // in the following functions will need to be targeted to specific
309 // RenderWidgetHosts in order to work with OOPIFs. See crbug.com/647249.
310
307 void WebContentsViewAndroid::OnDragEntered( 311 void WebContentsViewAndroid::OnDragEntered(
308 const std::vector<DropData::Metadata>& metadata, 312 const std::vector<DropData::Metadata>& metadata,
309 const gfx::Point& location, 313 const gfx::Point& location,
310 const gfx::Point& screen_location) { 314 const gfx::Point& screen_location) {
311 blink::WebDragOperationsMask allowed_ops = 315 blink::WebDragOperationsMask allowed_ops =
312 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy | 316 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
313 blink::WebDragOperationMove); 317 blink::WebDragOperationMove);
314 web_contents_->GetRenderViewHost()->DragTargetDragEnterWithMetaData( 318 web_contents_->GetRenderViewHost()->GetWidget()->
315 metadata, location, screen_location, allowed_ops, 0); 319 DragTargetDragEnterWithMetaData(metadata, location, screen_location,
320 allowed_ops, 0);
316 } 321 }
317 322
318 void WebContentsViewAndroid::OnDragUpdated(const gfx::Point& location, 323 void WebContentsViewAndroid::OnDragUpdated(const gfx::Point& location,
319 const gfx::Point& screen_location) { 324 const gfx::Point& screen_location) {
320 blink::WebDragOperationsMask allowed_ops = 325 blink::WebDragOperationsMask allowed_ops =
321 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy | 326 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
322 blink::WebDragOperationMove); 327 blink::WebDragOperationMove);
323 web_contents_->GetRenderViewHost()->DragTargetDragOver( 328 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDragOver(
324 location, screen_location, allowed_ops, 0); 329 location, screen_location, allowed_ops, 0);
325 } 330 }
326 331
327 void WebContentsViewAndroid::OnDragExited() { 332 void WebContentsViewAndroid::OnDragExited() {
328 web_contents_->GetRenderViewHost()->DragTargetDragLeave(); 333 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDragLeave();
329 } 334 }
330 335
331 void WebContentsViewAndroid::OnPerformDrop(DropData* drop_data, 336 void WebContentsViewAndroid::OnPerformDrop(DropData* drop_data,
332 const gfx::Point& location, 337 const gfx::Point& location,
333 const gfx::Point& screen_location) { 338 const gfx::Point& screen_location) {
334 web_contents_->GetRenderViewHost()->FilterDropData(drop_data); 339 web_contents_->GetRenderViewHost()->GetWidget()->FilterDropData(drop_data);
335 web_contents_->GetRenderViewHost()->DragTargetDrop(*drop_data, location, 340 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDrop(
336 screen_location, 0); 341 *drop_data, location, screen_location, 0);
337 } 342 }
338 343
339 void WebContentsViewAndroid::OnDragEnded() { 344 void WebContentsViewAndroid::OnDragEnded() {
340 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded(); 345 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();
341 } 346 }
342 347
343 void WebContentsViewAndroid::GotFocus() { 348 void WebContentsViewAndroid::GotFocus() {
344 // This is only used in the views FocusManager stuff but it bleeds through 349 // This is only used in the views FocusManager stuff but it bleeds through
345 // all subclasses. http://crbug.com/21875 350 // all subclasses. http://crbug.com/21875
346 } 351 }
347 352
348 // This is called when we the renderer asks us to take focus back (i.e., it has 353 // This is called when we the renderer asks us to take focus back (i.e., it has
349 // iterated past the last focusable element on the page). 354 // iterated past the last focusable element on the page).
350 void WebContentsViewAndroid::TakeFocus(bool reverse) { 355 void WebContentsViewAndroid::TakeFocus(bool reverse) {
351 if (web_contents_->GetDelegate() && 356 if (web_contents_->GetDelegate() &&
352 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 357 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
353 return; 358 return;
354 web_contents_->GetRenderWidgetHostView()->Focus(); 359 web_contents_->GetRenderWidgetHostView()->Focus();
355 } 360 }
356 361
357 } // namespace content 362 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698