| 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 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "ui/accessibility/ax_node_data.h" | 14 #include "ui/accessibility/ax_node_data.h" |
| 15 #include "ui/base/default_style.h" | 15 #include "ui/base/default_style.h" |
| 16 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
| 17 #include "ui/base/material_design/material_design_controller.h" | 17 #include "ui/base/material_design/material_design_controller.h" |
| 18 #include "ui/base/models/combobox_model_observer.h" | 18 #include "ui/base/models/combobox_model_observer.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
| 21 #include "ui/gfx/animation/throb_animation.h" | 21 #include "ui/gfx/animation/throb_animation.h" |
| 22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/color_palette.h" | 23 #include "ui/gfx/color_palette.h" |
| 24 #include "ui/gfx/scoped_canvas.h" | 24 #include "ui/gfx/scoped_canvas.h" |
| 25 #include "ui/gfx/text_utils.h" | 25 #include "ui/gfx/text_utils.h" |
| 26 #include "ui/native_theme/common_theme.h" | 26 #include "ui/native_theme/common_theme.h" |
| 27 #include "ui/native_theme/native_theme.h" | 27 #include "ui/native_theme/native_theme.h" |
| 28 #include "ui/native_theme/native_theme_aura.h" | 28 #include "ui/native_theme/native_theme_aura.h" |
| 29 #include "ui/resources/grit/ui_resources.h" | 29 #include "ui/resources/grit/ui_resources.h" |
| 30 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | |
| 31 #include "ui/views/animation/ink_drop_highlight.h" | 30 #include "ui/views/animation/ink_drop_highlight.h" |
| 32 #include "ui/views/animation/ink_drop_impl.h" | 31 #include "ui/views/animation/ink_drop_impl.h" |
| 32 #include "ui/views/animation/ink_drop_ripple.h" |
| 33 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
| 34 #include "ui/views/controls/button/custom_button.h" | 34 #include "ui/views/controls/button/custom_button.h" |
| 35 #include "ui/views/controls/button/label_button.h" | 35 #include "ui/views/controls/button/label_button.h" |
| 36 #include "ui/views/controls/combobox/combobox_listener.h" | 36 #include "ui/views/controls/combobox/combobox_listener.h" |
| 37 #include "ui/views/controls/focus_ring.h" | 37 #include "ui/views/controls/focus_ring.h" |
| 38 #include "ui/views/controls/focusable_border.h" | 38 #include "ui/views/controls/focusable_border.h" |
| 39 #include "ui/views/controls/menu/menu_config.h" | 39 #include "ui/views/controls/menu/menu_config.h" |
| 40 #include "ui/views/controls/menu/menu_runner.h" | 40 #include "ui/views/controls/menu/menu_runner.h" |
| 41 #include "ui/views/controls/prefix_selector.h" | 41 #include "ui/views/controls/prefix_selector.h" |
| 42 #include "ui/views/controls/textfield/textfield.h" | 42 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // platforms they do. | 135 // platforms they do. |
| 136 parent()->RequestFocus(); | 136 parent()->RequestFocus(); |
| 137 #endif | 137 #endif |
| 138 return CustomButton::OnMousePressed(mouse_event); | 138 return CustomButton::OnMousePressed(mouse_event); |
| 139 } | 139 } |
| 140 | 140 |
| 141 double GetAnimationValue() const { | 141 double GetAnimationValue() const { |
| 142 return hover_animation().GetCurrentValue(); | 142 return hover_animation().GetCurrentValue(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Overridden from InkDropHost: | 145 // InkDropHost: |
| 146 std::unique_ptr<InkDrop> CreateInkDrop() override { | 146 std::unique_ptr<InkDrop> CreateInkDrop() override { |
| 147 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); | 147 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); |
| 148 ink_drop->SetShowHighlightOnHover(false); | 148 ink_drop->SetShowHighlightOnHover(false); |
| 149 return std::move(ink_drop); | 149 return std::move(ink_drop); |
| 150 } | 150 } |
| 151 | 151 |
| 152 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override { | 152 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override { |
| 153 return std::unique_ptr<views::InkDropRipple>( | 153 return CreateFloodFillInkDropRipple(); |
| 154 new views::FloodFillInkDropRipple( | 154 } |
| 155 size(), GetInkDropCenterBasedOnLastEvent(), | 155 |
| 156 GetNativeTheme()->GetSystemColor( | 156 SkColor GetInkDropBaseColor() const override { |
| 157 ui::NativeTheme::kColorId_LabelEnabledColor), | 157 return GetNativeTheme()->GetSystemColor( |
| 158 ink_drop_visible_opacity())); | 158 ui::NativeTheme::kColorId_LabelEnabledColor); |
| 159 } | 159 } |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 DISALLOW_COPY_AND_ASSIGN(TransparentButton); | 162 DISALLOW_COPY_AND_ASSIGN(TransparentButton); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 #if !defined(OS_MACOSX) | 165 #if !defined(OS_MACOSX) |
| 166 // Returns the next or previous valid index (depending on |increment|'s value). | 166 // Returns the next or previous valid index (depending on |increment|'s value). |
| 167 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent | 167 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent |
| 168 // index. | 168 // index. |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 constexpr int kMdPaddingWidth = 8; | 1014 constexpr int kMdPaddingWidth = 8; |
| 1015 constexpr int kNormalPaddingWidth = 7; | 1015 constexpr int kNormalPaddingWidth = 7; |
| 1016 int arrow_pad = UseMd() ? kMdPaddingWidth : kNormalPaddingWidth; | 1016 int arrow_pad = UseMd() ? kMdPaddingWidth : kNormalPaddingWidth; |
| 1017 int padding = style_ == STYLE_NORMAL | 1017 int padding = style_ == STYLE_NORMAL |
| 1018 ? arrow_pad * 2 | 1018 ? arrow_pad * 2 |
| 1019 : kActionLeftPadding + kActionRightPadding; | 1019 : kActionLeftPadding + kActionRightPadding; |
| 1020 return ArrowSize().width() + padding; | 1020 return ArrowSize().width() + padding; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 } // namespace views | 1023 } // namespace views |
| OLD | NEW |