| 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 12 matching lines...) Expand all Loading... |
| 23 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 24 #include "ui/gfx/color_palette.h" | 24 #include "ui/gfx/color_palette.h" |
| 25 #include "ui/gfx/scoped_canvas.h" | 25 #include "ui/gfx/scoped_canvas.h" |
| 26 #include "ui/gfx/text_utils.h" | 26 #include "ui/gfx/text_utils.h" |
| 27 #include "ui/native_theme/common_theme.h" | 27 #include "ui/native_theme/common_theme.h" |
| 28 #include "ui/native_theme/native_theme.h" | 28 #include "ui/native_theme/native_theme.h" |
| 29 #include "ui/native_theme/native_theme_aura.h" | 29 #include "ui/native_theme/native_theme_aura.h" |
| 30 #include "ui/resources/grit/ui_resources.h" | 30 #include "ui/resources/grit/ui_resources.h" |
| 31 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 31 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 32 #include "ui/views/animation/ink_drop_highlight.h" | 32 #include "ui/views/animation/ink_drop_highlight.h" |
| 33 #include "ui/views/animation/ink_drop_impl.h" |
| 33 #include "ui/views/background.h" | 34 #include "ui/views/background.h" |
| 34 #include "ui/views/controls/button/custom_button.h" | 35 #include "ui/views/controls/button/custom_button.h" |
| 35 #include "ui/views/controls/button/label_button.h" | 36 #include "ui/views/controls/button/label_button.h" |
| 36 #include "ui/views/controls/combobox/combobox_listener.h" | 37 #include "ui/views/controls/combobox/combobox_listener.h" |
| 37 #include "ui/views/controls/focus_ring.h" | 38 #include "ui/views/controls/focus_ring.h" |
| 38 #include "ui/views/controls/focusable_border.h" | 39 #include "ui/views/controls/focusable_border.h" |
| 39 #include "ui/views/controls/menu/menu_config.h" | 40 #include "ui/views/controls/menu/menu_config.h" |
| 40 #include "ui/views/controls/menu/menu_runner.h" | 41 #include "ui/views/controls/menu/menu_runner.h" |
| 41 #include "ui/views/controls/prefix_selector.h" | 42 #include "ui/views/controls/prefix_selector.h" |
| 42 #include "ui/views/controls/textfield/textfield.h" | 43 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (!UseMd()) | 135 if (!UseMd()) |
| 135 parent()->RequestFocus(); | 136 parent()->RequestFocus(); |
| 136 return CustomButton::OnMousePressed(mouse_event); | 137 return CustomButton::OnMousePressed(mouse_event); |
| 137 } | 138 } |
| 138 | 139 |
| 139 double GetAnimationValue() const { | 140 double GetAnimationValue() const { |
| 140 return hover_animation().GetCurrentValue(); | 141 return hover_animation().GetCurrentValue(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Overridden from InkDropHost: | 144 // Overridden from InkDropHost: |
| 145 std::unique_ptr<InkDrop> CreateInkDrop() override { |
| 146 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); |
| 147 ink_drop->SetShowHighlightOnHover(false); |
| 148 return std::move(ink_drop); |
| 149 } |
| 150 |
| 144 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override { | 151 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override { |
| 145 return std::unique_ptr<views::InkDropRipple>( | 152 return std::unique_ptr<views::InkDropRipple>( |
| 146 new views::FloodFillInkDropRipple( | 153 new views::FloodFillInkDropRipple( |
| 147 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), | 154 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), |
| 148 GetNativeTheme()->GetSystemColor( | 155 GetNativeTheme()->GetSystemColor( |
| 149 ui::NativeTheme::kColorId_LabelEnabledColor), | 156 ui::NativeTheme::kColorId_LabelEnabledColor), |
| 150 ink_drop_visible_opacity())); | 157 ink_drop_visible_opacity())); |
| 151 } | 158 } |
| 152 | 159 |
| 153 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override { | |
| 154 return nullptr; | |
| 155 } | |
| 156 | |
| 157 private: | 160 private: |
| 158 DISALLOW_COPY_AND_ASSIGN(TransparentButton); | 161 DISALLOW_COPY_AND_ASSIGN(TransparentButton); |
| 159 }; | 162 }; |
| 160 | 163 |
| 161 // Returns the next or previous valid index (depending on |increment|'s value). | 164 // Returns the next or previous valid index (depending on |increment|'s value). |
| 162 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent | 165 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent |
| 163 // index. | 166 // index. |
| 164 int GetAdjacentIndex(ui::ComboboxModel* model, int increment, int index) { | 167 int GetAdjacentIndex(ui::ComboboxModel* model, int increment, int index) { |
| 165 DCHECK(increment == -1 || increment == 1); | 168 DCHECK(increment == -1 || increment == 1); |
| 166 | 169 |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 const int kMdPaddingWidth = 8; | 992 const int kMdPaddingWidth = 8; |
| 990 int arrow_pad = UseMd() ? kMdPaddingWidth | 993 int arrow_pad = UseMd() ? kMdPaddingWidth |
| 991 : PlatformStyle::kComboboxNormalArrowPadding; | 994 : PlatformStyle::kComboboxNormalArrowPadding; |
| 992 int padding = style_ == STYLE_NORMAL | 995 int padding = style_ == STYLE_NORMAL |
| 993 ? arrow_pad * 2 | 996 ? arrow_pad * 2 |
| 994 : kActionLeftPadding + kActionRightPadding; | 997 : kActionLeftPadding + kActionRightPadding; |
| 995 return ArrowSize().width() + padding; | 998 return ArrowSize().width() + padding; |
| 996 } | 999 } |
| 997 | 1000 |
| 998 } // namespace views | 1001 } // namespace views |
| OLD | NEW |