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

Side by Side Diff: ui/views/controls/combobox/combobox.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
OLDNEW
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/combobox/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 937 }
938 menu_runner_->RunMenuAt(GetWidget(), nullptr, bounds, anchor_position, 938 menu_runner_->RunMenuAt(GetWidget(), nullptr, bounds, anchor_position,
939 source_type); 939 source_type);
940 } 940 }
941 941
942 void Combobox::OnMenuClosed(Button::ButtonState original_button_state) { 942 void Combobox::OnMenuClosed(Button::ButtonState original_button_state) {
943 menu_runner_.reset(); 943 menu_runner_.reset();
944 if (arrow_button_) 944 if (arrow_button_)
945 arrow_button_->SetState(original_button_state); 945 arrow_button_->SetState(original_button_state);
946 closed_time_ = base::Time::Now(); 946 closed_time_ = base::Time::Now();
947
948 // Need to explicitly clear mouse handler so that events get sent
949 // properly after the menu finishes running. If we don't do this, then
950 // the first click to other parts of the UI is eaten.
951 SetMouseHandler(NULL);
952 } 947 }
953 948
954 void Combobox::OnPerformAction() { 949 void Combobox::OnPerformAction() {
955 NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, false); 950 NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, false);
956 SchedulePaint(); 951 SchedulePaint();
957 952
958 // This combobox may be deleted by the listener. 953 // This combobox may be deleted by the listener.
959 base::WeakPtr<Combobox> weak_ptr = weak_ptr_factory_.GetWeakPtr(); 954 base::WeakPtr<Combobox> weak_ptr = weak_ptr_factory_.GetWeakPtr();
960 if (listener_) 955 if (listener_)
961 listener_->OnPerformAction(this); 956 listener_->OnPerformAction(this);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 const int kMdPaddingWidth = 8; 989 const int kMdPaddingWidth = 8;
995 int arrow_pad = UseMd() ? kMdPaddingWidth 990 int arrow_pad = UseMd() ? kMdPaddingWidth
996 : PlatformStyle::kComboboxNormalArrowPadding; 991 : PlatformStyle::kComboboxNormalArrowPadding;
997 int padding = style_ == STYLE_NORMAL 992 int padding = style_ == STYLE_NORMAL
998 ? arrow_pad * 2 993 ? arrow_pad * 2
999 : kActionLeftPadding + kActionRightPadding; 994 : kActionLeftPadding + kActionRightPadding;
1000 return ArrowSize().width() + padding; 995 return ArrowSize().width() + padding;
1001 } 996 }
1002 997
1003 } // namespace views 998 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_button.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698