| OLD | NEW |
| 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 menu_runner_->RunMenuAt(GetWidget(), nullptr, bounds, anchor_position, | 940 menu_runner_->RunMenuAt(GetWidget(), nullptr, bounds, anchor_position, |
| 941 source_type); | 941 source_type); |
| 942 } | 942 } |
| 943 | 943 |
| 944 void Combobox::OnMenuClosed(Button::ButtonState original_button_state) { | 944 void Combobox::OnMenuClosed(Button::ButtonState original_button_state) { |
| 945 menu_runner_.reset(); | 945 menu_runner_.reset(); |
| 946 menu_model_adapter_.reset(); | 946 menu_model_adapter_.reset(); |
| 947 if (arrow_button_) | 947 if (arrow_button_) |
| 948 arrow_button_->SetState(original_button_state); | 948 arrow_button_->SetState(original_button_state); |
| 949 closed_time_ = base::Time::Now(); | 949 closed_time_ = base::Time::Now(); |
| 950 | |
| 951 // Need to explicitly clear mouse handler so that events get sent | |
| 952 // properly after the menu finishes running. If we don't do this, then | |
| 953 // the first click to other parts of the UI is eaten. | |
| 954 SetMouseHandler(NULL); | |
| 955 } | 950 } |
| 956 | 951 |
| 957 void Combobox::OnPerformAction() { | 952 void Combobox::OnPerformAction() { |
| 958 NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, false); | 953 NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, false); |
| 959 SchedulePaint(); | 954 SchedulePaint(); |
| 960 | 955 |
| 961 // This combobox may be deleted by the listener. | 956 // This combobox may be deleted by the listener. |
| 962 base::WeakPtr<Combobox> weak_ptr = weak_ptr_factory_.GetWeakPtr(); | 957 base::WeakPtr<Combobox> weak_ptr = weak_ptr_factory_.GetWeakPtr(); |
| 963 if (listener_) | 958 if (listener_) |
| 964 listener_->OnPerformAction(this); | 959 listener_->OnPerformAction(this); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 const int kMdPaddingWidth = 8; | 992 const int kMdPaddingWidth = 8; |
| 998 int arrow_pad = UseMd() ? kMdPaddingWidth | 993 int arrow_pad = UseMd() ? kMdPaddingWidth |
| 999 : PlatformStyle::kComboboxNormalArrowPadding; | 994 : PlatformStyle::kComboboxNormalArrowPadding; |
| 1000 int padding = style_ == STYLE_NORMAL | 995 int padding = style_ == STYLE_NORMAL |
| 1001 ? arrow_pad * 2 | 996 ? arrow_pad * 2 |
| 1002 : kActionLeftPadding + kActionRightPadding; | 997 : kActionLeftPadding + kActionRightPadding; |
| 1003 return ArrowSize().width() + padding; | 998 return ArrowSize().width() + padding; |
| 1004 } | 999 } |
| 1005 | 1000 |
| 1006 } // namespace views | 1001 } // namespace views |
| OLD | NEW |