OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/os_exchange_data.h" | 8 #include "app/os_exchange_data.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "gfx/canvas_skia.h" | 12 #include "gfx/canvas.h" |
13 #include "views/controls/button/menu_button.h" | 13 #include "views/controls/button/menu_button.h" |
14 #include "views/controls/menu/menu_scroll_view_container.h" | 14 #include "views/controls/menu/menu_scroll_view_container.h" |
15 #include "views/controls/menu/submenu_view.h" | 15 #include "views/controls/menu/submenu_view.h" |
16 #include "views/drag_utils.h" | 16 #include "views/drag_utils.h" |
17 #include "views/screen.h" | 17 #include "views/screen.h" |
18 #include "views/view_constants.h" | 18 #include "views/view_constants.h" |
19 #include "views/views_delegate.h" | 19 #include "views/views_delegate.h" |
20 #include "views/widget/root_view.h" | 20 #include "views/widget/root_view.h" |
21 #include "views/widget/widget.h" | 21 #include "views/widget/widget.h" |
22 | 22 |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 event.y() - press_pt_.y())) { | 463 event.y() - press_pt_.y())) { |
464 MenuItemView* item = state_.item; | 464 MenuItemView* item = state_.item; |
465 DCHECK(item); | 465 DCHECK(item); |
466 // Points are in the coordinates of the submenu, need to map to that of | 466 // Points are in the coordinates of the submenu, need to map to that of |
467 // the selected item. Additionally source may not be the parent of | 467 // the selected item. Additionally source may not be the parent of |
468 // the selected item, so need to map to screen first then to item. | 468 // the selected item, so need to map to screen first then to item. |
469 gfx::Point press_loc(press_pt_); | 469 gfx::Point press_loc(press_pt_); |
470 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); | 470 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); |
471 View::ConvertPointToView(NULL, item, &press_loc); | 471 View::ConvertPointToView(NULL, item, &press_loc); |
472 // TODO(beng): Convert to CanvasSkia | 472 // TODO(beng): Convert to CanvasSkia |
473 gfx::CanvasSkia canvas(item->width(), item->height(), false); | 473 gfx::Canvas canvas(item->width(), item->height(), false); |
474 item->Paint(&canvas, true); | 474 item->Paint(&canvas, true); |
475 | 475 |
476 OSExchangeData data; | 476 OSExchangeData data; |
477 item->GetDelegate()->WriteDragData(item, &data); | 477 item->GetDelegate()->WriteDragData(item, &data); |
478 drag_utils::SetDragImageOnDataObject(canvas, item->size(), press_loc, | 478 drag_utils::SetDragImageOnDataObject(canvas, item->size(), press_loc, |
479 &data); | 479 &data); |
480 StopScrolling(); | 480 StopScrolling(); |
481 int drag_ops = item->GetDelegate()->GetDragOperations(item); | 481 int drag_ops = item->GetDelegate()->GetDragOperations(item); |
482 drag_in_progress_ = true; | 482 drag_in_progress_ = true; |
483 item->GetRootView()->StartDragForViewFromMouseEvent( | 483 item->GetRootView()->StartDragForViewFromMouseEvent( |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 | 1734 |
1735 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); | 1735 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); |
1736 // Reset the active_mouse_view_ before sending mouse released. That way if if | 1736 // Reset the active_mouse_view_ before sending mouse released. That way if if |
1737 // calls back to use we aren't in a weird state. | 1737 // calls back to use we aren't in a weird state. |
1738 View* active_view = active_mouse_view_; | 1738 View* active_view = active_mouse_view_; |
1739 active_mouse_view_ = NULL; | 1739 active_mouse_view_ = NULL; |
1740 active_view->OnMouseReleased(release_event, true); | 1740 active_view->OnMouseReleased(release_event, true); |
1741 } | 1741 } |
1742 | 1742 |
1743 } // namespace views | 1743 } // namespace views |
OLD | NEW |