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

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: 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // Pretend we were resized so that the renderers size is updated too. 276 // Pretend we were resized so that the renderers size is updated too.
277 SizeChangedCommon(size); 277 SizeChangedCommon(size);
278 278
279 } 279 }
280 } 280 }
281 281
282 void WebContentsViewAura::RenderViewCreated(content::RenderViewHost* host) { 282 void WebContentsViewAura::RenderViewCreated(content::RenderViewHost* host) {
283 } 283 }
284 284
285 void WebContentsViewAura::Focus() { 285 void WebContentsViewAura::Focus() {
286 if (tab_contents_->GetInterstitialPage()) { 286 if (web_contents_->GetInterstitialPage()) {
287 tab_contents_->GetInterstitialPage()->Focus(); 287 web_contents_->GetInterstitialPage()->Focus();
288 return; 288 return;
289 } 289 }
290 290
291 if (delegate_.get() && delegate_->Focus()) 291 if (delegate_.get() && delegate_->Focus())
292 return; 292 return;
293 293
294 content::RenderWidgetHostView* rwhv = 294 content::RenderWidgetHostView* rwhv =
295 tab_contents_->GetRenderWidgetHostView(); 295 web_contents_->GetRenderWidgetHostView();
296 if (rwhv) 296 if (rwhv)
297 rwhv->Focus(); 297 rwhv->Focus();
298 } 298 }
299 299
300 void WebContentsViewAura::SetInitialFocus() { 300 void WebContentsViewAura::SetInitialFocus() {
301 if (tab_contents_->FocusLocationBarByDefault()) 301 if (web_contents_->FocusLocationBarByDefault())
302 tab_contents_->SetFocusToLocationBar(false); 302 web_contents_->SetFocusToLocationBar(false);
303 else 303 else
304 Focus(); 304 Focus();
305 } 305 }
306 306
307 void WebContentsViewAura::StoreFocus() { 307 void WebContentsViewAura::StoreFocus() {
308 if (delegate_.get()) 308 if (delegate_.get())
309 delegate_->StoreFocus(); 309 delegate_->StoreFocus();
310 } 310 }
311 311
312 void WebContentsViewAura::RestoreFocus() { 312 void WebContentsViewAura::RestoreFocus() {
(...skipping 30 matching lines...) Expand all
343 void WebContentsViewAura::GetViewBounds(gfx::Rect* out) const { 343 void WebContentsViewAura::GetViewBounds(gfx::Rect* out) const {
344 *out = window_->GetScreenBounds(); 344 *out = window_->GetScreenBounds();
345 } 345 }
346 346
347 //////////////////////////////////////////////////////////////////////////////// 347 ////////////////////////////////////////////////////////////////////////////////
348 // WebContentsViewAura, RenderViewHostDelegate::View implementation: 348 // WebContentsViewAura, RenderViewHostDelegate::View implementation:
349 349
350 void WebContentsViewAura::CreateNewWindow( 350 void WebContentsViewAura::CreateNewWindow(
351 int route_id, 351 int route_id,
352 const ViewHostMsg_CreateWindow_Params& params) { 352 const ViewHostMsg_CreateWindow_Params& params) {
353 web_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); 353 web_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params);
354 } 354 }
355 355
356 void WebContentsViewAura::CreateNewWidget(int route_id, 356 void WebContentsViewAura::CreateNewWidget(int route_id,
357 WebKit::WebPopupType popup_type) { 357 WebKit::WebPopupType popup_type) {
358 web_contents_view_helper_.CreateNewWidget(tab_contents_, 358 web_contents_view_helper_.CreateNewWidget(web_contents_,
359 route_id, 359 route_id,
360 false, 360 false,
361 popup_type); 361 popup_type);
362 } 362 }
363 363
364 void WebContentsViewAura::CreateNewFullscreenWidget(int route_id) { 364 void WebContentsViewAura::CreateNewFullscreenWidget(int route_id) {
365 web_contents_view_helper_.CreateNewWidget(tab_contents_, 365 web_contents_view_helper_.CreateNewWidget(web_contents_,
366 route_id, 366 route_id,
367 true, 367 true,
368 WebKit::WebPopupTypeNone); 368 WebKit::WebPopupTypeNone);
369 } 369 }
370 370
371 void WebContentsViewAura::ShowCreatedWindow(int route_id, 371 void WebContentsViewAura::ShowCreatedWindow(int route_id,
372 WindowOpenDisposition disposition, 372 WindowOpenDisposition disposition,
373 const gfx::Rect& initial_pos, 373 const gfx::Rect& initial_pos,
374 bool user_gesture) { 374 bool user_gesture) {
375 web_contents_view_helper_.ShowCreatedWindow( 375 web_contents_view_helper_.ShowCreatedWindow(
376 tab_contents_, route_id, disposition, initial_pos, user_gesture); 376 web_contents_, route_id, disposition, initial_pos, user_gesture);
377 } 377 }
378 378
379 void WebContentsViewAura::ShowCreatedWidget(int route_id, 379 void WebContentsViewAura::ShowCreatedWidget(int route_id,
380 const gfx::Rect& initial_pos) { 380 const gfx::Rect& initial_pos) {
381 web_contents_view_helper_.ShowCreatedWidget(tab_contents_, 381 web_contents_view_helper_.ShowCreatedWidget(web_contents_,
382 route_id, 382 route_id,
383 false, 383 false,
384 initial_pos); 384 initial_pos);
385 } 385 }
386 386
387 void WebContentsViewAura::ShowCreatedFullscreenWidget(int route_id) { 387 void WebContentsViewAura::ShowCreatedFullscreenWidget(int route_id) {
388 web_contents_view_helper_.ShowCreatedWidget(tab_contents_, 388 web_contents_view_helper_.ShowCreatedWidget(web_contents_,
389 route_id, 389 route_id,
390 true, 390 true,
391 gfx::Rect()); 391 gfx::Rect());
392 } 392 }
393 393
394 void WebContentsViewAura::ShowContextMenu( 394 void WebContentsViewAura::ShowContextMenu(
395 const content::ContextMenuParams& params) { 395 const content::ContextMenuParams& params) {
396 // Allow WebContentsDelegates to handle the context menu operation first. 396 // Allow WebContentsDelegates to handle the context menu operation first.
397 if (tab_contents_->GetDelegate() && 397 if (web_contents_->GetDelegate() &&
398 tab_contents_->GetDelegate()->HandleContextMenu(params)) { 398 web_contents_->GetDelegate()->HandleContextMenu(params)) {
399 return; 399 return;
400 } 400 }
401 401
402 if (delegate_.get()) 402 if (delegate_.get())
403 delegate_->ShowContextMenu(params); 403 delegate_->ShowContextMenu(params);
404 } 404 }
405 405
406 void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds, 406 void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds,
407 int item_height, 407 int item_height,
408 double item_font_size, 408 double item_font_size,
(...skipping 13 matching lines...) Expand all
422 if (!aura::client::GetDragDropClient(root_window)) 422 if (!aura::client::GetDragDropClient(root_window))
423 return; 423 return;
424 424
425 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura; 425 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
426 PrepareDragData(drop_data, provider); 426 PrepareDragData(drop_data, provider);
427 if (!image.isNull()) 427 if (!image.isNull())
428 provider->set_drag_image(image); 428 provider->set_drag_image(image);
429 ui::OSExchangeData data(provider); // takes ownership of |provider|. 429 ui::OSExchangeData data(provider); // takes ownership of |provider|.
430 430
431 scoped_ptr<WebDragSourceAura> drag_source( 431 scoped_ptr<WebDragSourceAura> drag_source(
432 new WebDragSourceAura(tab_contents_)); 432 new WebDragSourceAura(web_contents_));
433 433
434 // We need to enable recursive tasks on the message loop so we can get 434 // We need to enable recursive tasks on the message loop so we can get
435 // updates while in the system DoDragDrop loop. 435 // updates while in the system DoDragDrop loop.
436 int result_op = 0; 436 int result_op = 0;
437 { 437 {
438 // TODO(sad): Avoid using last_mouse_location here, since the drag may not 438 // TODO(sad): Avoid using last_mouse_location here, since the drag may not
439 // always start from a mouse-event (e.g. a touch or gesture event could 439 // always start from a mouse-event (e.g. a touch or gesture event could
440 // initiate the drag). The location information should be carried over from 440 // initiate the drag). The location information should be carried over from
441 // webkit. http://crbug.com/114754 441 // webkit. http://crbug.com/114754
442 gfx::Point location(root_window->last_mouse_location()); 442 gfx::Point location(root_window->last_mouse_location());
443 location.Offset(-image_offset.x(), -image_offset.y()); 443 location.Offset(-image_offset.x(), -image_offset.y());
444 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 444 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
445 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( 445 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
446 data, location, ConvertFromWeb(operations)); 446 data, location, ConvertFromWeb(operations));
447 } 447 }
448 448
449 EndDrag(ConvertToWeb(result_op)); 449 EndDrag(ConvertToWeb(result_op));
450 tab_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();} 450 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();}
451 451
452 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) { 452 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) {
453 current_drag_op_ = operation; 453 current_drag_op_ = operation;
454 } 454 }
455 455
456 void WebContentsViewAura::GotFocus() { 456 void WebContentsViewAura::GotFocus() {
457 if (tab_contents_->GetDelegate()) 457 if (web_contents_->GetDelegate())
458 tab_contents_->GetDelegate()->WebContentsFocused(tab_contents_); 458 web_contents_->GetDelegate()->WebContentsFocused(web_contents_);
459 } 459 }
460 460
461 void WebContentsViewAura::TakeFocus(bool reverse) { 461 void WebContentsViewAura::TakeFocus(bool reverse) {
462 if (tab_contents_->GetDelegate() && 462 if (web_contents_->GetDelegate() &&
463 !tab_contents_->GetDelegate()->TakeFocus(reverse) && 463 !web_contents_->GetDelegate()->TakeFocus(reverse) &&
464 delegate_.get()) { 464 delegate_.get()) {
465 delegate_->TakeFocus(reverse); 465 delegate_->TakeFocus(reverse);
466 } 466 }
467 } 467 }
468 468
469 //////////////////////////////////////////////////////////////////////////////// 469 ////////////////////////////////////////////////////////////////////////////////
470 // WebContentsViewAura, aura::WindowDelegate implementation: 470 // WebContentsViewAura, aura::WindowDelegate implementation:
471 471
472 gfx::Size WebContentsViewAura::GetMinimumSize() const { 472 gfx::Size WebContentsViewAura::GetMinimumSize() const {
473 return gfx::Size(); 473 return gfx::Size();
(...skipping 18 matching lines...) Expand all
492 492
493 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) { 493 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {
494 return gfx::kNullCursor; 494 return gfx::kNullCursor;
495 } 495 }
496 496
497 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const { 497 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const {
498 return HTCLIENT; 498 return HTCLIENT;
499 } 499 }
500 500
501 bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) { 501 bool WebContentsViewAura::OnMouseEvent(aura::MouseEvent* event) {
502 if (!tab_contents_->GetDelegate()) 502 if (!web_contents_->GetDelegate())
503 return false; 503 return false;
504 504
505 switch (event->type()) { 505 switch (event->type()) {
506 case ui::ET_MOUSE_PRESSED: 506 case ui::ET_MOUSE_PRESSED:
507 tab_contents_->GetDelegate()->ActivateContents(tab_contents_); 507 web_contents_->GetDelegate()->ActivateContents(web_contents_);
508 break; 508 break;
509 case ui::ET_MOUSE_MOVED: 509 case ui::ET_MOUSE_MOVED:
510 tab_contents_->GetDelegate()->ContentsMouseEvent( 510 web_contents_->GetDelegate()->ContentsMouseEvent(
511 tab_contents_, gfx::Screen::GetCursorScreenPoint(), true); 511 web_contents_, gfx::Screen::GetCursorScreenPoint(), true);
512 break; 512 break;
513 default: 513 default:
514 break; 514 break;
515 } 515 }
516 return false; 516 return false;
517 } 517 }
518 518
519 ui::TouchStatus WebContentsViewAura::OnTouchEvent(aura::TouchEvent* event) { 519 ui::TouchStatus WebContentsViewAura::OnTouchEvent(aura::TouchEvent* event) {
520 return ui::TOUCH_STATUS_UNKNOWN; 520 return ui::TOUCH_STATUS_UNKNOWN;
521 } 521 }
(...skipping 14 matching lines...) Expand all
536 } 536 }
537 537
538 void WebContentsViewAura::OnWindowDestroying() { 538 void WebContentsViewAura::OnWindowDestroying() {
539 } 539 }
540 540
541 void WebContentsViewAura::OnWindowDestroyed() { 541 void WebContentsViewAura::OnWindowDestroyed() {
542 } 542 }
543 543
544 void WebContentsViewAura::OnWindowVisibilityChanged(bool visible) { 544 void WebContentsViewAura::OnWindowVisibilityChanged(bool visible) {
545 if (visible) 545 if (visible)
546 tab_contents_->ShowContents(); 546 web_contents_->ShowContents();
547 else 547 else
548 tab_contents_->HideContents(); 548 web_contents_->HideContents();
549 } 549 }
550 //////////////////////////////////////////////////////////////////////////////// 550 ////////////////////////////////////////////////////////////////////////////////
551 // WebContentsViewAura, aura::client::DragDropDelegate implementation: 551 // WebContentsViewAura, aura::client::DragDropDelegate implementation:
552 552
553 void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) { 553 void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) {
554 if (GetDragDestDelegate()) 554 if (GetDragDestDelegate())
555 GetDragDestDelegate()->DragInitialize(tab_contents_); 555 GetDragDestDelegate()->DragInitialize(web_contents_);
556 556
557 WebDropData drop_data; 557 WebDropData drop_data;
558 PrepareWebDropData(&drop_data, event.data()); 558 PrepareWebDropData(&drop_data, event.data());
559 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); 559 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
560 560
561 gfx::Point screen_pt = 561 gfx::Point screen_pt =
562 GetNativeView()->GetRootWindow()->last_mouse_location(); 562 GetNativeView()->GetRootWindow()->last_mouse_location();
563 tab_contents_->GetRenderViewHost()->DragTargetDragEnter( 563 web_contents_->GetRenderViewHost()->DragTargetDragEnter(
564 drop_data, event.location(), screen_pt, op); 564 drop_data, event.location(), screen_pt, op);
565 565
566 if (GetDragDestDelegate()) { 566 if (GetDragDestDelegate()) {
567 GetDragDestDelegate()->OnReceiveDragData(event.data()); 567 GetDragDestDelegate()->OnReceiveDragData(event.data());
568 GetDragDestDelegate()->OnDragEnter(); 568 GetDragDestDelegate()->OnDragEnter();
569 } 569 }
570 } 570 }
571 571
572 int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) { 572 int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) {
573 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); 573 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
574 gfx::Point screen_pt = 574 gfx::Point screen_pt =
575 GetNativeView()->GetRootWindow()->last_mouse_location(); 575 GetNativeView()->GetRootWindow()->last_mouse_location();
576 tab_contents_->GetRenderViewHost()->DragTargetDragOver( 576 web_contents_->GetRenderViewHost()->DragTargetDragOver(
577 event.location(), screen_pt, op); 577 event.location(), screen_pt, op);
578 578
579 if (GetDragDestDelegate()) 579 if (GetDragDestDelegate())
580 GetDragDestDelegate()->OnDragOver(); 580 GetDragDestDelegate()->OnDragOver();
581 581
582 return ConvertFromWeb(current_drag_op_); 582 return ConvertFromWeb(current_drag_op_);
583 } 583 }
584 584
585 void WebContentsViewAura::OnDragExited() { 585 void WebContentsViewAura::OnDragExited() {
586 tab_contents_->GetRenderViewHost()->DragTargetDragLeave(); 586 web_contents_->GetRenderViewHost()->DragTargetDragLeave();
587 if (GetDragDestDelegate()) 587 if (GetDragDestDelegate())
588 GetDragDestDelegate()->OnDragLeave(); 588 GetDragDestDelegate()->OnDragLeave();
589 } 589 }
590 590
591 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) { 591 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) {
592 tab_contents_->GetRenderViewHost()->DragTargetDrop( 592 web_contents_->GetRenderViewHost()->DragTargetDrop(
593 event.location(), 593 event.location(),
594 GetNativeView()->GetRootWindow()->last_mouse_location()); 594 GetNativeView()->GetRootWindow()->last_mouse_location());
595 if (GetDragDestDelegate()) 595 if (GetDragDestDelegate())
596 GetDragDestDelegate()->OnDrop(); 596 GetDragDestDelegate()->OnDrop();
597 return current_drag_op_; 597 return current_drag_op_;
598 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698