Chromium Code Reviews| Index: ui/views/controls/button/custom_button.cc |
| diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc |
| index 61b595bbfeb2f059327527ad3c1ef18e76afb270..55a543239d00923241dbb73075be4f772814e9ba 100644 |
| --- a/ui/views/controls/button/custom_button.cc |
| +++ b/ui/views/controls/button/custom_button.cc |
| @@ -251,6 +251,10 @@ void CustomButton::OnGestureEvent(ui::GestureEvent* event) { |
| } |
| bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| + if ((IsChildWidget() && !FocusInChildWidget()) || |
|
sky
2015/11/17 14:22:39
This is subtle enough that it is worth a comment.
meacer
2015/11/17 18:56:26
Done.
|
| + (!IsChildWidget() && !GetWidget()->IsActive())) { |
| + return false; |
| + } |
| SetState(STATE_NORMAL); |
| // TODO(beng): remove once NotifyClick takes ui::Event. |
| ui::MouseEvent synthetic_event( |
| @@ -378,4 +382,14 @@ void CustomButton::OnBlur() { |
| SetState(STATE_NORMAL); |
| } |
| +bool CustomButton::IsChildWidget() const { |
| + return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); |
| +} |
| + |
| +bool CustomButton::FocusInChildWidget() const { |
| + return GetWidget() && |
| + GetWidget()->GetRootView()->Contains( |
| + GetFocusManager()->GetFocusedView()); |
| +} |
| + |
| } // namespace views |