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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 MenuItemView* item = state_.item; | 1178 MenuItemView* item = state_.item; |
1179 DCHECK(item); | 1179 DCHECK(item); |
1180 // Points are in the coordinates of the submenu, need to map to that of | 1180 // Points are in the coordinates of the submenu, need to map to that of |
1181 // the selected item. Additionally source may not be the parent of | 1181 // the selected item. Additionally source may not be the parent of |
1182 // the selected item, so need to map to screen first then to item. | 1182 // the selected item, so need to map to screen first then to item. |
1183 gfx::Point press_loc(location); | 1183 gfx::Point press_loc(location); |
1184 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); | 1184 View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); |
1185 View::ConvertPointFromScreen(item, &press_loc); | 1185 View::ConvertPointFromScreen(item, &press_loc); |
1186 gfx::Point widget_loc(press_loc); | 1186 gfx::Point widget_loc(press_loc); |
1187 View::ConvertPointToWidget(item, &widget_loc); | 1187 View::ConvertPointToWidget(item, &widget_loc); |
1188 scoped_ptr<gfx::Canvas> canvas(GetCanvasForDragImage( | 1188 std::unique_ptr<gfx::Canvas> canvas(GetCanvasForDragImage( |
1189 source->GetWidget(), gfx::Size(item->width(), item->height()))); | 1189 source->GetWidget(), gfx::Size(item->width(), item->height()))); |
1190 item->PaintButton(canvas.get(), MenuItemView::PB_FOR_DRAG); | 1190 item->PaintButton(canvas.get(), MenuItemView::PB_FOR_DRAG); |
1191 | 1191 |
1192 OSExchangeData data; | 1192 OSExchangeData data; |
1193 item->GetDelegate()->WriteDragData(item, &data); | 1193 item->GetDelegate()->WriteDragData(item, &data); |
1194 drag_utils::SetDragImageOnDataObject(*canvas, | 1194 drag_utils::SetDragImageOnDataObject(*canvas, |
1195 press_loc.OffsetFromOrigin(), | 1195 press_loc.OffsetFromOrigin(), |
1196 &data); | 1196 &data); |
1197 StopScrolling(); | 1197 StopScrolling(); |
1198 int drag_ops = item->GetDelegate()->GetDragOperations(item); | 1198 int drag_ops = item->GetDelegate()->GetDragOperations(item); |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 return; | 2667 return; |
2668 } | 2668 } |
2669 if (hot_button_) | 2669 if (hot_button_) |
2670 hot_button_->SetHotTracked(false); | 2670 hot_button_->SetHotTracked(false); |
2671 hot_button_ = hot_button; | 2671 hot_button_ = hot_button; |
2672 if (hot_button) | 2672 if (hot_button) |
2673 hot_button->SetHotTracked(true); | 2673 hot_button->SetHotTracked(true); |
2674 } | 2674 } |
2675 | 2675 |
2676 } // namespace views | 2676 } // namespace views |
OLD | NEW |