| Index: ui/views/controls/menu/menu_host.cc
|
| diff --git a/ui/views/controls/menu/menu_host.cc b/ui/views/controls/menu/menu_host.cc
|
| index 2716ec8bb782c1a46288c0ab449d80a2a96e2caf..3a8217f55485fef566d69f9ebb05ca28dab60a67 100644
|
| --- a/ui/views/controls/menu/menu_host.cc
|
| +++ b/ui/views/controls/menu/menu_host.cc
|
| @@ -135,4 +135,34 @@ void MenuHost::OnOwnerClosing() {
|
| menu_controller->CancelAll();
|
| }
|
|
|
| +void MenuHost::OnDragWillStart() {
|
| + MenuController* menu_controller =
|
| + submenu_->GetMenuItem()->GetMenuController();
|
| + DCHECK(menu_controller);
|
| + menu_controller->OnDragWillStart();
|
| +}
|
| +
|
| +void MenuHost::OnDragComplete() {
|
| + MenuController* menu_controller =
|
| + submenu_->GetMenuItem()->GetMenuController();
|
| + if (destroying_ || !menu_controller)
|
| + return;
|
| +
|
| + bool should_close = true;
|
| + // If the view came from outside menu code (i.e., not a MenuItemView), we
|
| + // should consult the MenuDelegate to determine whether or not to close on
|
| + // exit.
|
| + if (!menu_controller->did_initiate_drag()) {
|
| + MenuDelegate* menu_delegate = submenu_->GetMenuItem()->GetDelegate();
|
| + should_close =
|
| + menu_delegate ? menu_delegate->ShouldCloseOnDragComplete() : should_close;
|
| + }
|
| + menu_controller->OnDragComplete(should_close);
|
| +
|
| + // We may have lost capture in the drag and drop, but are remaining open.
|
| + // Return capture so we get MouseCaptureLost events.
|
| + if (!should_close)
|
| + native_widget_private()->SetCapture();
|
| +}
|
| +
|
| } // namespace views
|
|
|