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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 2450903002: MacViews: Clear mouse handler when showing context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test on both Mac and Windows. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/combobox/combobox.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/toolbar/toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 ignore_result(menu_runner_->RunMenuAt( 226 ignore_result(menu_runner_->RunMenuAt(
227 GetWidget(), nullptr, gfx::Rect(menu_position, gfx::Size(0, 0)), 227 GetWidget(), nullptr, gfx::Rect(menu_position, gfx::Size(0, 0)),
228 views::MENU_ANCHOR_TOPLEFT, source_type)); 228 views::MENU_ANCHOR_TOPLEFT, source_type));
229 } 229 }
230 230
231 void ToolbarButton::OnMenuClosed() { 231 void ToolbarButton::OnMenuClosed() {
232 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); 232 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */);
233 233
234 menu_showing_ = false; 234 menu_showing_ = false;
235 235
236 // Need to explicitly clear mouse handler so that events get sent
237 // properly after the menu finishes running. If we don't do this, then
238 // the first click to other parts of the UI is eaten.
239 SetMouseHandler(nullptr);
240
241 // Set the state back to normal after the drop down menu is closed. 236 // Set the state back to normal after the drop down menu is closed.
242 if (state() != STATE_DISABLED) 237 if (state() != STATE_DISABLED)
243 SetState(STATE_NORMAL); 238 SetState(STATE_NORMAL);
244 239
245 menu_runner_.reset(); 240 menu_runner_.reset();
246 menu_model_adapter_.reset(); 241 menu_model_adapter_.reset();
247 } 242 }
248 243
249 const char* ToolbarButton::GetClassName() const { 244 const char* ToolbarButton::GetClassName() const {
250 return "ToolbarButton"; 245 return "ToolbarButton";
251 } 246 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/combobox/combobox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698