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

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

Issue 10038026: TabContents -> WebContentsImpl, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: *web*contents Created 8 years, 8 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 | Annotate | Revision Log
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_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/renderer_host/render_view_host_factory.h" 8 #include "content/browser/renderer_host/render_view_host_factory.h"
9 #include "content/browser/web_contents/interstitial_page_impl.h" 9 #include "content/browser/web_contents/interstitial_page_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 16 matching lines...) Expand all
27 #include "ui/gfx/compositor/layer.h" 27 #include "ui/gfx/compositor/layer.h"
28 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
29 #include "webkit/glue/webdropdata.h" 29 #include "webkit/glue/webdropdata.h"
30 30
31 namespace { 31 namespace {
32 32
33 // Listens to all mouse drag events during a drag and drop and sends them to 33 // Listens to all mouse drag events during a drag and drop and sends them to
34 // the renderer. 34 // the renderer.
35 class WebDragSourceAura : public MessageLoopForUI::Observer { 35 class WebDragSourceAura : public MessageLoopForUI::Observer {
36 public: 36 public:
37 explicit WebDragSourceAura(TabContents* contents) 37 explicit WebDragSourceAura(WebContentsImpl* contents)
38 : contents_(contents) { 38 : contents_(contents) {
39 MessageLoopForUI::current()->AddObserver(this); 39 MessageLoopForUI::current()->AddObserver(this);
40 } 40 }
41 41
42 virtual ~WebDragSourceAura() { 42 virtual ~WebDragSourceAura() {
43 MessageLoopForUI::current()->RemoveObserver(this); 43 MessageLoopForUI::current()->RemoveObserver(this);
44 } 44 }
45 45
46 // MessageLoop::Observer implementation: 46 // MessageLoop::Observer implementation:
47 virtual base::EventStatus WillProcessEvent( 47 virtual base::EventStatus WillProcessEvent(
(...skipping 16 matching lines...) Expand all
64 screen_loc.x(), screen_loc.y()); 64 screen_loc.x(), screen_loc.y());
65 } 65 }
66 break; 66 break;
67 default: 67 default:
68 break; 68 break;
69 } 69 }
70 } 70 }
71 71
72 72
73 private: 73 private:
74 TabContents* contents_; 74 WebContentsImpl* contents_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura); 76 DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura);
77 }; 77 };
78 78
79 // Utility to fill a ui::OSExchangeDataProviderAura object from WebDropData. 79 // Utility to fill a ui::OSExchangeDataProviderAura object from WebDropData.
80 void PrepareDragData(const WebDropData& drop_data, 80 void PrepareDragData(const WebDropData& drop_data,
81 ui::OSExchangeDataProviderAura* provider) { 81 ui::OSExchangeDataProviderAura* provider) {
82 if (!drop_data.plain_text.empty()) 82 if (!drop_data.plain_text.empty())
83 provider->SetString(drop_data.plain_text); 83 provider->SetString(drop_data.plain_text);
84 if (drop_data.url.is_valid()) 84 if (drop_data.url.is_valid())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return (WebKit::WebDragOperationsMask) web_drag_op; 156 return (WebKit::WebDragOperationsMask) web_drag_op;
157 } 157 }
158 158
159 } // namespace 159 } // namespace
160 160
161 161
162 //////////////////////////////////////////////////////////////////////////////// 162 ////////////////////////////////////////////////////////////////////////////////
163 // WebContentsViewAura, public: 163 // WebContentsViewAura, public:
164 164
165 WebContentsViewAura::WebContentsViewAura( 165 WebContentsViewAura::WebContentsViewAura(
166 TabContents* tab_contents, 166 WebContentsImpl* web_contents,
167 content::WebContentsViewDelegate* delegate) 167 content::WebContentsViewDelegate* delegate)
168 : tab_contents_(tab_contents), 168 : web_contents_(web_contents),
169 view_(NULL), 169 view_(NULL),
170 delegate_(delegate), 170 delegate_(delegate),
171 current_drag_op_(WebKit::WebDragOperationNone), 171 current_drag_op_(WebKit::WebDragOperationNone),
172 close_tab_after_drag_ends_(false) { 172 close_tab_after_drag_ends_(false) {
173 } 173 }
174 174
175 WebContentsViewAura::~WebContentsViewAura() { 175 WebContentsViewAura::~WebContentsViewAura() {
176 } 176 }
177 177
178 //////////////////////////////////////////////////////////////////////////////// 178 ////////////////////////////////////////////////////////////////////////////////
179 // WebContentsViewAura, private: 179 // WebContentsViewAura, private:
180 180
181 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { 181 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) {
182 if (tab_contents_->GetInterstitialPage()) 182 if (web_contents_->GetInterstitialPage())
183 tab_contents_->GetInterstitialPage()->SetSize(size); 183 web_contents_->GetInterstitialPage()->SetSize(size);
184 content::RenderWidgetHostView* rwhv = 184 content::RenderWidgetHostView* rwhv =
185 tab_contents_->GetRenderWidgetHostView(); 185 web_contents_->GetRenderWidgetHostView();
186 if (rwhv) 186 if (rwhv)
187 rwhv->SetSize(size); 187 rwhv->SetSize(size);
188 } 188 }
189 189
190 void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { 190 void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) {
191 aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); 191 aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
192 gfx::Point screen_loc = root_window->last_mouse_location(); 192 gfx::Point screen_loc = root_window->last_mouse_location();
193 gfx::Point client_loc = screen_loc; 193 gfx::Point client_loc = screen_loc;
194 content::RenderViewHost* rvh = tab_contents_->GetRenderViewHost(); 194 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
195 aura::Window* window = rvh->GetView()->GetNativeView(); 195 aura::Window* window = rvh->GetView()->GetNativeView();
196 aura::Window::ConvertPointToWindow(root_window, window, &client_loc); 196 aura::Window::ConvertPointToWindow(root_window, window, &client_loc);
197 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), 197 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(),
198 screen_loc.y(), ops); 198 screen_loc.y(), ops);
199 } 199 }
200 200
201 content::WebDragDestDelegate* WebContentsViewAura::GetDragDestDelegate() { 201 content::WebDragDestDelegate* WebContentsViewAura::GetDragDestDelegate() {
202 return delegate_.get() ? delegate_->GetDragDestDelegate() : NULL; 202 return delegate_.get() ? delegate_->GetDragDestDelegate() : NULL;
203 } 203 }
204 204
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Pretend we were resized so that the renderers size is updated too. 278 // Pretend we were resized so that the renderers size is updated too.
279 SizeChangedCommon(size); 279 SizeChangedCommon(size);
280 280
281 } 281 }
282 } 282 }
283 283
284 void WebContentsViewAura::RenderViewCreated(content::RenderViewHost* host) { 284 void WebContentsViewAura::RenderViewCreated(content::RenderViewHost* host) {
285 } 285 }
286 286
287 void WebContentsViewAura::Focus() { 287 void WebContentsViewAura::Focus() {
288 if (tab_contents_->GetInterstitialPage()) { 288 if (web_contents_->GetInterstitialPage()) {
289 tab_contents_->GetInterstitialPage()->Focus(); 289 web_contents_->GetInterstitialPage()->Focus();
290 return; 290 return;
291 } 291 }
292 292
293 if (delegate_.get() && delegate_->Focus()) 293 if (delegate_.get() && delegate_->Focus())
294 return; 294 return;
295 295
296 content::RenderWidgetHostView* rwhv = 296 content::RenderWidgetHostView* rwhv =
297 tab_contents_->GetRenderWidgetHostView(); 297 web_contents_->GetRenderWidgetHostView();
298 if (rwhv) 298 if (rwhv)
299 rwhv->Focus(); 299 rwhv->Focus();
300 } 300 }
301 301
302 void WebContentsViewAura::SetInitialFocus() { 302 void WebContentsViewAura::SetInitialFocus() {
303 if (tab_contents_->FocusLocationBarByDefault()) 303 if (web_contents_->FocusLocationBarByDefault())
304 tab_contents_->SetFocusToLocationBar(false); 304 web_contents_->SetFocusToLocationBar(false);
305 else 305 else
306 Focus(); 306 Focus();
307 } 307 }
308 308
309 void WebContentsViewAura::StoreFocus() { 309 void WebContentsViewAura::StoreFocus() {
310 if (delegate_.get()) 310 if (delegate_.get())
311 delegate_->StoreFocus(); 311 delegate_->StoreFocus();
312 } 312 }
313 313
314 void WebContentsViewAura::RestoreFocus() { 314 void WebContentsViewAura::RestoreFocus() {
(...skipping 30 matching lines...) Expand all
345 void WebContentsViewAura::GetViewBounds(gfx::Rect* out) const { 345 void WebContentsViewAura::GetViewBounds(gfx::Rect* out) const {
346 *out = window_->GetScreenBounds(); 346 *out = window_->GetScreenBounds();
347 } 347 }
348 348
349 //////////////////////////////////////////////////////////////////////////////// 349 ////////////////////////////////////////////////////////////////////////////////
350 // WebContentsViewAura, RenderViewHostDelegate::View implementation: 350 // WebContentsViewAura, RenderViewHostDelegate::View implementation:
351 351
352 void WebContentsViewAura::CreateNewWindow( 352 void WebContentsViewAura::CreateNewWindow(
353 int route_id, 353 int route_id,
354 const ViewHostMsg_CreateWindow_Params& params) { 354 const ViewHostMsg_CreateWindow_Params& params) {
355 web_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); 355 web_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params);
356 } 356 }
357 357
358 void WebContentsViewAura::CreateNewWidget(int route_id, 358 void WebContentsViewAura::CreateNewWidget(int route_id,
359 WebKit::WebPopupType popup_type) { 359 WebKit::WebPopupType popup_type) {
360 web_contents_view_helper_.CreateNewWidget(tab_contents_, 360 web_contents_view_helper_.CreateNewWidget(web_contents_,
361 route_id, 361 route_id,
362 false, 362 false,
363 popup_type); 363 popup_type);
364 } 364 }
365 365
366 void WebContentsViewAura::CreateNewFullscreenWidget(int route_id) { 366 void WebContentsViewAura::CreateNewFullscreenWidget(int route_id) {
367 web_contents_view_helper_.CreateNewWidget(tab_contents_, 367 web_contents_view_helper_.CreateNewWidget(web_contents_,
368 route_id, 368 route_id,
369 true, 369 true,
370 WebKit::WebPopupTypeNone); 370 WebKit::WebPopupTypeNone);
371 } 371 }
372 372
373 void WebContentsViewAura::ShowCreatedWindow(int route_id, 373 void WebContentsViewAura::ShowCreatedWindow(int route_id,
374 WindowOpenDisposition disposition, 374 WindowOpenDisposition disposition,
375 const gfx::Rect& initial_pos, 375 const gfx::Rect& initial_pos,
376 bool user_gesture) { 376 bool user_gesture) {
377 web_contents_view_helper_.ShowCreatedWindow( 377 web_contents_view_helper_.ShowCreatedWindow(
378 tab_contents_, route_id, disposition, initial_pos, user_gesture); 378 web_contents_, route_id, disposition, initial_pos, user_gesture);
379 } 379 }
380 380
381 void WebContentsViewAura::ShowCreatedWidget(int route_id, 381 void WebContentsViewAura::ShowCreatedWidget(int route_id,
382 const gfx::Rect& initial_pos) { 382 const gfx::Rect& initial_pos) {
383 web_contents_view_helper_.ShowCreatedWidget(tab_contents_, 383 web_contents_view_helper_.ShowCreatedWidget(web_contents_,
384 route_id, 384 route_id,
385 false, 385 false,
386 initial_pos); 386 initial_pos);
387 } 387 }
388 388
389 void WebContentsViewAura::ShowCreatedFullscreenWidget(int route_id) { 389 void WebContentsViewAura::ShowCreatedFullscreenWidget(int route_id) {
390 web_contents_view_helper_.ShowCreatedWidget(tab_contents_, 390 web_contents_view_helper_.ShowCreatedWidget(web_contents_,
391 route_id, 391 route_id,
392 true, 392 true,
393 gfx::Rect()); 393 gfx::Rect());
394 } 394 }
395 395
396 void WebContentsViewAura::ShowContextMenu( 396 void WebContentsViewAura::ShowContextMenu(
397 const content::ContextMenuParams& params) { 397 const content::ContextMenuParams& params) {
398 // Allow WebContentsDelegates to handle the context menu operation first. 398 // Allow WebContentsDelegates to handle the context menu operation first.
399 if (tab_contents_->GetDelegate() && 399 if (web_contents_->GetDelegate() &&
400 tab_contents_->GetDelegate()->HandleContextMenu(params)) { 400 web_contents_->GetDelegate()->HandleContextMenu(params)) {
401 return; 401 return;
402 } 402 }
403 403
404 if (delegate_.get()) 404 if (delegate_.get())
405 delegate_->ShowContextMenu(params); 405 delegate_->ShowContextMenu(params);
406 } 406 }
407 407
408 void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds, 408 void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds,
409 int item_height, 409 int item_height,
410 double item_font_size, 410 double item_font_size,
(...skipping 13 matching lines...) Expand all
424 if (!aura::client::GetDragDropClient(root_window)) 424 if (!aura::client::GetDragDropClient(root_window))
425 return; 425 return;
426 426
427 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura; 427 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
428 PrepareDragData(drop_data, provider); 428 PrepareDragData(drop_data, provider);
429 if (!image.isNull()) 429 if (!image.isNull())
430 provider->set_drag_image(image); 430 provider->set_drag_image(image);
431 ui::OSExchangeData data(provider); // takes ownership of |provider|. 431 ui::OSExchangeData data(provider); // takes ownership of |provider|.
432 432
433 scoped_ptr<WebDragSourceAura> drag_source( 433 scoped_ptr<WebDragSourceAura> drag_source(
434 new WebDragSourceAura(tab_contents_)); 434 new WebDragSourceAura(web_contents_));
435 435
436 // We need to enable recursive tasks on the message loop so we can get 436 // We need to enable recursive tasks on the message loop so we can get
437 // updates while in the system DoDragDrop loop. 437 // updates while in the system DoDragDrop loop.
438 int result_op = 0; 438 int result_op = 0;
439 { 439 {
440 // TODO(sad): Avoid using last_mouse_location here, since the drag may not 440 // TODO(sad): Avoid using last_mouse_location here, since the drag may not
441 // always start from a mouse-event (e.g. a touch or gesture event could 441 // always start from a mouse-event (e.g. a touch or gesture event could
442 // initiate the drag). The location information should be carried over from 442 // initiate the drag). The location information should be carried over from
443 // webkit. http://crbug.com/114754 443 // webkit. http://crbug.com/114754
444 gfx::Point location(root_window->last_mouse_location()); 444 gfx::Point location(root_window->last_mouse_location());
445 location.Offset(-image_offset.x(), -image_offset.y()); 445 location.Offset(-image_offset.x(), -image_offset.y());
446 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 446 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
447 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( 447 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
448 data, location, ConvertFromWeb(operations)); 448 data, location, ConvertFromWeb(operations));
449 } 449 }
450 450
451 EndDrag(ConvertToWeb(result_op)); 451 EndDrag(ConvertToWeb(result_op));
452 tab_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();} 452 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();}
453 453
454 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) { 454 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) {
455 current_drag_op_ = operation; 455 current_drag_op_ = operation;
456 } 456 }
457 457
458 void WebContentsViewAura::GotFocus() { 458 void WebContentsViewAura::GotFocus() {
459 if (tab_contents_->GetDelegate()) 459 if (web_contents_->GetDelegate())
460 tab_contents_->GetDelegate()->WebContentsFocused(tab_contents_); 460 web_contents_->GetDelegate()->WebContentsFocused(web_contents_);
461 } 461 }
462 462
463 void WebContentsViewAura::TakeFocus(bool reverse) { 463 void WebContentsViewAura::TakeFocus(bool reverse) {
464 if (tab_contents_->GetDelegate() && 464 if (web_contents_->GetDelegate() &&
465 !tab_contents_->GetDelegate()->TakeFocus(reverse) && 465 !web_contents_->GetDelegate()->TakeFocus(reverse) &&
466 delegate_.get()) { 466 delegate_.get()) {
467 delegate_->TakeFocus(reverse); 467 delegate_->TakeFocus(reverse);
468 } 468 }
469 } 469 }
470 470
471 //////////////////////////////////////////////////////////////////////////////// 471 ////////////////////////////////////////////////////////////////////////////////
472 // WebContentsViewAura, aura::WindowDelegate implementation: 472 // WebContentsViewAura, aura::WindowDelegate implementation:
473 473
474 gfx::Size WebContentsViewAura::GetMinimumSize() const { 474 gfx::Size WebContentsViewAura::GetMinimumSize() const {
475 return gfx::Size(); 475 return gfx::Size();
(...skipping 18 matching lines...) Expand all
494 494
495 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) { 495 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {
496 return gfx::kNullCursor; 496 return gfx::kNullCursor;
497 } 497 }
498 498
499 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const { 499 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const {
500 return HTCLIENT; 500 return HTCLIENT;
501 } 501 }
502 502
503 bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) { 503 bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) {
504 if (!tab_contents_->GetDelegate()) 504 if (!web_contents_->GetDelegate())
505 return false; 505 return false;
506 506
507 switch (event->type()) { 507 switch (event->type()) {
508 case ui::ET_MOUSE_PRESSED: 508 case ui::ET_MOUSE_PRESSED:
509 tab_contents_->GetDelegate()->ActivateContents(tab_contents_); 509 web_contents_->GetDelegate()->ActivateContents(web_contents_);
510 break; 510 break;
511 case ui::ET_MOUSE_MOVED: 511 case ui::ET_MOUSE_MOVED:
512 tab_contents_->GetDelegate()->ContentsMouseEvent( 512 web_contents_->GetDelegate()->ContentsMouseEvent(
513 tab_contents_, gfx::Screen::GetCursorScreenPoint(), true); 513 web_contents_, gfx::Screen::GetCursorScreenPoint(), true);
514 break; 514 break;
515 default: 515 default:
516 break; 516 break;
517 } 517 }
518 return false; 518 return false;
519 } 519 }
520 520
521 ui::TouchStatus WebContentsViewAura::OnTouchEvent(aura::TouchEvent* event) { 521 ui::TouchStatus WebContentsViewAura::OnTouchEvent(aura::TouchEvent* event) {
522 return ui::TOUCH_STATUS_UNKNOWN; 522 return ui::TOUCH_STATUS_UNKNOWN;
523 } 523 }
(...skipping 14 matching lines...) Expand all
538 } 538 }
539 539
540 void WebContentsViewAura::OnWindowDestroying() { 540 void WebContentsViewAura::OnWindowDestroying() {
541 } 541 }
542 542
543 void WebContentsViewAura::OnWindowDestroyed() { 543 void WebContentsViewAura::OnWindowDestroyed() {
544 } 544 }
545 545
546 void WebContentsViewAura::OnWindowVisibilityChanged(bool visible) { 546 void WebContentsViewAura::OnWindowVisibilityChanged(bool visible) {
547 if (visible) 547 if (visible)
548 tab_contents_->ShowContents(); 548 web_contents_->ShowContents();
549 else 549 else
550 tab_contents_->HideContents(); 550 web_contents_->HideContents();
551 } 551 }
552 //////////////////////////////////////////////////////////////////////////////// 552 ////////////////////////////////////////////////////////////////////////////////
553 // WebContentsViewAura, aura::client::DragDropDelegate implementation: 553 // WebContentsViewAura, aura::client::DragDropDelegate implementation:
554 554
555 void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) { 555 void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) {
556 if (GetDragDestDelegate()) 556 if (GetDragDestDelegate())
557 GetDragDestDelegate()->DragInitialize(tab_contents_); 557 GetDragDestDelegate()->DragInitialize(web_contents_);
558 558
559 WebDropData drop_data; 559 WebDropData drop_data;
560 PrepareWebDropData(&drop_data, event.data()); 560 PrepareWebDropData(&drop_data, event.data());
561 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); 561 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
562 562
563 gfx::Point screen_pt = 563 gfx::Point screen_pt =
564 GetNativeView()->GetRootWindow()->last_mouse_location(); 564 GetNativeView()->GetRootWindow()->last_mouse_location();
565 tab_contents_->GetRenderViewHost()->DragTargetDragEnter( 565 web_contents_->GetRenderViewHost()->DragTargetDragEnter(
566 drop_data, event.location(), screen_pt, op); 566 drop_data, event.location(), screen_pt, op);
567 567
568 if (GetDragDestDelegate()) { 568 if (GetDragDestDelegate()) {
569 GetDragDestDelegate()->OnReceiveDragData(event.data()); 569 GetDragDestDelegate()->OnReceiveDragData(event.data());
570 GetDragDestDelegate()->OnDragEnter(); 570 GetDragDestDelegate()->OnDragEnter();
571 } 571 }
572 } 572 }
573 573
574 int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) { 574 int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) {
575 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); 575 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
576 gfx::Point screen_pt = 576 gfx::Point screen_pt =
577 GetNativeView()->GetRootWindow()->last_mouse_location(); 577 GetNativeView()->GetRootWindow()->last_mouse_location();
578 tab_contents_->GetRenderViewHost()->DragTargetDragOver( 578 web_contents_->GetRenderViewHost()->DragTargetDragOver(
579 event.location(), screen_pt, op); 579 event.location(), screen_pt, op);
580 580
581 if (GetDragDestDelegate()) 581 if (GetDragDestDelegate())
582 GetDragDestDelegate()->OnDragOver(); 582 GetDragDestDelegate()->OnDragOver();
583 583
584 return ConvertFromWeb(current_drag_op_); 584 return ConvertFromWeb(current_drag_op_);
585 } 585 }
586 586
587 void WebContentsViewAura::OnDragExited() { 587 void WebContentsViewAura::OnDragExited() {
588 tab_contents_->GetRenderViewHost()->DragTargetDragLeave(); 588 web_contents_->GetRenderViewHost()->DragTargetDragLeave();
589 if (GetDragDestDelegate()) 589 if (GetDragDestDelegate())
590 GetDragDestDelegate()->OnDragLeave(); 590 GetDragDestDelegate()->OnDragLeave();
591 } 591 }
592 592
593 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) { 593 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) {
594 tab_contents_->GetRenderViewHost()->DragTargetDrop( 594 web_contents_->GetRenderViewHost()->DragTargetDrop(
595 event.location(), 595 event.location(),
596 GetNativeView()->GetRootWindow()->last_mouse_location()); 596 GetNativeView()->GetRootWindow()->last_mouse_location());
597 if (GetDragDestDelegate()) 597 if (GetDragDestDelegate())
598 GetDragDestDelegate()->OnDrop(); 598 GetDragDestDelegate()->OnDrop();
599 return current_drag_op_; 599 return current_drag_op_;
600 } 600 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | content/browser/web_contents/web_contents_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698