Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| index d935524540f9a19c9e4c5bbd65a5084b5f4304ed..a828fc31d795ee63823600b19924f18f8c1b4f12 100644 |
| --- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| @@ -42,6 +42,7 @@ |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/geometry/rect.h" |
| #include "ui/views/controls/button/label_button_border.h" |
| +#include "ui/views/controls/menu/menu_controller.h" |
| #include "ui/views/controls/resize_area.h" |
| #include "ui/views/metrics.h" |
| #include "ui/views/painter.h" |
| @@ -464,6 +465,17 @@ int BrowserActionsContainer::OnDragUpdated( |
| void BrowserActionsContainer::OnDragExited() { |
| StopShowFolderDropMenuTimer(); |
| + if (in_overflow_mode()) { |
|
sky
2014/07/09 16:09:16
This is too fragile. The menu code should change s
Devlin
2014/07/09 18:03:41
Okay - let's try this approach. It seems to fit t
|
| + views::MenuController* controller = |
| + views::MenuController::GetActiveInstance(); |
| + // Notify the controller that we finished our drag. |
| + if (controller) |
| + controller->set_drag_in_progress(false); |
| + // During the drag, the widget lost mouse capture (even though it |
| + // conceptually retained it). Reset the capture to this so that future |
| + // capture losses (like clicking outside of the menu) register again. |
| + GetWidget()->SetCapture(this); |
| + } |
| drop_indicator_position_ = -1; |
| SchedulePaint(); |
| } |
| @@ -531,6 +543,14 @@ void BrowserActionsContainer::WriteDragDataForView(View* sender, |
| OSExchangeData* data) { |
| DCHECK(data); |
| + if (in_overflow_mode()) { |
| + views::MenuController* controller = |
| + views::MenuController::GetActiveInstance(); |
| + // Notify the controller that a drag is in progress so that reported |
| + // capture losses are ignored appropriately. |
| + if (controller) |
| + controller->set_drag_in_progress(true); |
| + } |
| for (size_t i = 0; i < browser_action_views_.size(); ++i) { |
| BrowserActionButton* button = browser_action_views_[i]->button(); |
| if (button == sender) { |