OLD | NEW |
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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); | 852 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); |
853 View::ConvertPointToTarget(NULL, item, &press_loc); | 853 View::ConvertPointToTarget(NULL, item, &press_loc); |
854 gfx::Point widget_loc(press_loc); | 854 gfx::Point widget_loc(press_loc); |
855 View::ConvertPointToWidget(item, &widget_loc); | 855 View::ConvertPointToWidget(item, &widget_loc); |
856 scoped_ptr<gfx::Canvas> canvas(views::GetCanvasForDragImage( | 856 scoped_ptr<gfx::Canvas> canvas(views::GetCanvasForDragImage( |
857 source->GetWidget(), gfx::Size(item->width(), item->height()))); | 857 source->GetWidget(), gfx::Size(item->width(), item->height()))); |
858 item->PaintButton(canvas.get(), MenuItemView::PB_FOR_DRAG); | 858 item->PaintButton(canvas.get(), MenuItemView::PB_FOR_DRAG); |
859 | 859 |
860 OSExchangeData data; | 860 OSExchangeData data; |
861 item->GetDelegate()->WriteDragData(item, &data); | 861 item->GetDelegate()->WriteDragData(item, &data); |
862 drag_utils::SetDragImageOnDataObject(*canvas, item->size(), press_loc, | 862 drag_utils::SetDragImageOnDataObject(*canvas, item->size(), |
| 863 press_loc.OffsetFromOrigin(), |
863 &data); | 864 &data); |
864 StopScrolling(); | 865 StopScrolling(); |
865 int drag_ops = item->GetDelegate()->GetDragOperations(item); | 866 int drag_ops = item->GetDelegate()->GetDragOperations(item); |
866 drag_in_progress_ = true; | 867 drag_in_progress_ = true; |
867 item->GetWidget()->RunShellDrag(NULL, data, widget_loc, drag_ops); | 868 item->GetWidget()->RunShellDrag(NULL, data, widget_loc, drag_ops); |
868 drag_in_progress_ = false; | 869 drag_in_progress_ = false; |
869 | 870 |
870 if (GetActiveInstance() == this) { | 871 if (GetActiveInstance() == this) { |
871 if (showing_) { | 872 if (showing_) { |
872 // We're still showing, close all menus. | 873 // We're still showing, close all menus. |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 | 2138 |
2138 gfx::Screen* MenuController::GetScreen() { | 2139 gfx::Screen* MenuController::GetScreen() { |
2139 #if defined(USE_AURA) | 2140 #if defined(USE_AURA) |
2140 return gfx::Screen::GetScreenFor(root_window_); | 2141 return gfx::Screen::GetScreenFor(root_window_); |
2141 #else | 2142 #else |
2142 return gfx::Screen::GetNativeScreen(); | 2143 return gfx::Screen::GetNativeScreen(); |
2143 #endif | 2144 #endif |
2144 } | 2145 } |
2145 | 2146 |
2146 } // namespace views | 2147 } // namespace views |
OLD | NEW |