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

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 2070623003: [MacViews] Show combobox menu popup at mouse press (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 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 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.
tapted 2016/06/29 12:02:55 cl description nit: wordwrap at <80 chars
spqchan 2016/06/29 18:29:14 Done.
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
11 #include "base/logging.h" 11 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return bounds; 103 return bounds;
104 } 104 }
105 105
106 // The transparent button which holds a button state but is not rendered. 106 // The transparent button which holds a button state but is not rendered.
107 class TransparentButton : public CustomButton { 107 class TransparentButton : public CustomButton {
108 public: 108 public:
109 TransparentButton(ButtonListener* listener) 109 TransparentButton(ButtonListener* listener)
110 : CustomButton(listener) { 110 : CustomButton(listener) {
111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); 111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs);
112 SetFocusBehavior(FocusBehavior::NEVER); 112 SetFocusBehavior(FocusBehavior::NEVER);
113 set_notify_action(PlatformStyle::kMenuActivationAction);
113 } 114 }
114 ~TransparentButton() override {} 115 ~TransparentButton() override {}
115 116
117 #if defined(OS_MACOSX)
118 // Override OnMousePressed() to transfer focus on the parent() on a click
tapted 2016/06/29 12:02:55 "on the parent() on a click" -> "to the parent() o
spqchan 2016/06/29 18:29:14 Done.
119 // on Mac, which doesn't transfer focus when buttons are clicked.
116 bool OnMousePressed(const ui::MouseEvent& mouse_event) override { 120 bool OnMousePressed(const ui::MouseEvent& mouse_event) override {
117 parent()->RequestFocus(); 121 parent()->RequestFocus();
122 CustomButton::OnMousePressed(mouse_event);
tapted 2016/06/29 12:02:55 nit: remove this bit (although I think it's fine,
spqchan 2016/06/29 18:29:14 We need this actually because CustomButton::MouseP
tapted 2016/06/29 23:24:43 Ah! So, I think we can remove this once the #ifdef
118 return true; 123 return true;
119 } 124 }
125 #endif
120 126
121 double GetAnimationValue() const { 127 double GetAnimationValue() const {
122 return hover_animation().GetCurrentValue(); 128 return hover_animation().GetCurrentValue();
123 } 129 }
124 130
125 private: 131 private:
126 DISALLOW_COPY_AND_ASSIGN(TransparentButton); 132 DISALLOW_COPY_AND_ASSIGN(TransparentButton);
127 }; 133 };
128 134
129 // Returns the next or previous valid index (depending on |increment|'s value). 135 // Returns the next or previous valid index (depending on |increment|'s value).
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } 900 }
895 901
896 int Combobox::GetArrowContainerWidth() const { 902 int Combobox::GetArrowContainerWidth() const {
897 int padding = style_ == STYLE_NORMAL 903 int padding = style_ == STYLE_NORMAL
898 ? PlatformStyle::kComboboxNormalArrowPadding * 2 904 ? PlatformStyle::kComboboxNormalArrowPadding * 2
899 : kActionLeftPadding + kActionRightPadding; 905 : kActionLeftPadding + kActionRightPadding;
900 return ArrowSize().width() + padding; 906 return ArrowSize().width() + padding;
901 } 907 }
902 908
903 } // namespace views 909 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/combobox/combobox_unittest.cc » ('j') | ui/views/controls/combobox/combobox_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698