OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/menu/menu_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/dragdrop/os_exchange_data.h" | 10 #include "ui/base/dragdrop/os_exchange_data.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 event.y() - press_pt_.y())) { | 452 event.y() - press_pt_.y())) { |
453 MenuItemView* item = state_.item; | 453 MenuItemView* item = state_.item; |
454 DCHECK(item); | 454 DCHECK(item); |
455 // Points are in the coordinates of the submenu, need to map to that of | 455 // Points are in the coordinates of the submenu, need to map to that of |
456 // the selected item. Additionally source may not be the parent of | 456 // the selected item. Additionally source may not be the parent of |
457 // the selected item, so need to map to screen first then to item. | 457 // the selected item, so need to map to screen first then to item. |
458 gfx::Point press_loc(press_pt_); | 458 gfx::Point press_loc(press_pt_); |
459 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); | 459 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); |
460 View::ConvertPointToView(NULL, item, &press_loc); | 460 View::ConvertPointToView(NULL, item, &press_loc); |
461 // TODO(beng): Convert to CanvasSkia | 461 // TODO(beng): Convert to CanvasSkia |
462 gfx::CanvasSkia canvas(item->width(), item->height(), false); | 462 gfx::CanvasSkia canvas; |
| 463 canvas.Init(item->width(), item->height(), false); |
463 item->PaintButton(&canvas, MenuItemView::PB_FOR_DRAG); | 464 item->PaintButton(&canvas, MenuItemView::PB_FOR_DRAG); |
464 | 465 |
465 OSExchangeData data; | 466 OSExchangeData data; |
466 item->GetDelegate()->WriteDragData(item, &data); | 467 item->GetDelegate()->WriteDragData(item, &data); |
467 drag_utils::SetDragImageOnDataObject(canvas, item->size(), press_loc, | 468 drag_utils::SetDragImageOnDataObject(canvas, item->size(), press_loc, |
468 &data); | 469 &data); |
469 StopScrolling(); | 470 StopScrolling(); |
470 int drag_ops = item->GetDelegate()->GetDragOperations(item); | 471 int drag_ops = item->GetDelegate()->GetDragOperations(item); |
471 drag_in_progress_ = true; | 472 drag_in_progress_ = true; |
472 item->GetWidget()->RunShellDrag(NULL, data, drag_ops); | 473 item->GetWidget()->RunShellDrag(NULL, data, drag_ops); |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 return; | 1846 return; |
1846 | 1847 |
1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if | 1848 // Reset the active_mouse_view_ before sending mouse capture lost. That way if |
1848 // it calls back to us, we aren't in a weird state. | 1849 // it calls back to us, we aren't in a weird state. |
1849 View* active_view = active_mouse_view_; | 1850 View* active_view = active_mouse_view_; |
1850 active_mouse_view_ = NULL; | 1851 active_mouse_view_ = NULL; |
1851 active_view->OnMouseCaptureLost(); | 1852 active_view->OnMouseCaptureLost(); |
1852 } | 1853 } |
1853 | 1854 |
1854 } // namespace views | 1855 } // namespace views |
OLD | NEW |