Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3617)

Unified Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 378333003: Allow menus to stay open during a child view's drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698