Chromium Code Reviews| 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/button/checkbox.h" | 5 #include "ui/views/controls/button/checkbox.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ui/accessibility/ax_node_data.h" | 11 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/base/material_design/material_design_controller.h" | 12 #include "ui/base/material_design/material_design_controller.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
| 15 #include "ui/gfx/color_utils.h" | 15 #include "ui/gfx/color_utils.h" |
| 16 #include "ui/gfx/paint_vector_icon.h" | 16 #include "ui/gfx/paint_vector_icon.h" |
| 17 #include "ui/resources/grit/ui_resources.h" | 17 #include "ui/resources/grit/ui_resources.h" |
| 18 #include "ui/views/animation/ink_drop_highlight.h" | |
| 18 #include "ui/views/animation/ink_drop_ripple.h" | 19 #include "ui/views/animation/ink_drop_ripple.h" |
| 19 #include "ui/views/animation/square_ink_drop_ripple.h" | 20 #include "ui/views/animation/square_ink_drop_ripple.h" |
| 20 #include "ui/views/controls/button/label_button_border.h" | 21 #include "ui/views/controls/button/label_button_border.h" |
| 21 #include "ui/views/painter.h" | 22 #include "ui/views/painter.h" |
| 22 #include "ui/views/resources/grit/views_resources.h" | 23 #include "ui/views/resources/grit/views_resources.h" |
| 23 #include "ui/views/style/platform_style.h" | 24 #include "ui/views/style/platform_style.h" |
| 24 #include "ui/views/vector_icons.h" | 25 #include "ui/views/vector_icons.h" |
| 25 | 26 |
| 26 namespace views { | 27 namespace views { |
| 27 | 28 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { | 163 std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { |
| 163 // The "small" size is 21dp, the large size is 1.33 * 21dp = 28dp. | 164 // The "small" size is 21dp, the large size is 1.33 * 21dp = 28dp. |
| 164 const gfx::Size size(21, 21); | 165 const gfx::Size size(21, 21); |
| 165 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( | 166 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( |
| 166 CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size, | 167 CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size, |
| 167 kInkDropSmallCornerRadius, image()->GetMirroredBounds().CenterPoint(), | 168 kInkDropSmallCornerRadius, image()->GetMirroredBounds().CenterPoint(), |
| 168 GetInkDropBaseColor(), ink_drop_visible_opacity())); | 169 GetInkDropBaseColor(), ink_drop_visible_opacity())); |
| 169 return ripple; | 170 return ripple; |
| 170 } | 171 } |
| 171 | 172 |
| 173 std::unique_ptr<views::InkDropHighlight> Checkbox::CreateInkDropHighlight() | |
| 174 const { | |
| 175 return nullptr; | |
|
sky
2017/05/26 02:28:54
Is harmony the default everywhere not? If not, won
Bret
2017/05/26 19:58:25
Harmony isn't on by default yet. Checkboxes don't
| |
| 176 } | |
| 177 | |
| 172 SkColor Checkbox::GetInkDropBaseColor() const { | 178 SkColor Checkbox::GetInkDropBaseColor() const { |
| 173 return GetNativeTheme()->GetSystemColor( | 179 return GetNativeTheme()->GetSystemColor( |
| 174 ui::NativeTheme::kColorId_ButtonEnabledColor); | 180 ui::NativeTheme::kColorId_ButtonEnabledColor); |
| 175 } | 181 } |
| 176 | 182 |
| 177 gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const { | 183 gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const { |
| 178 if (UseMd()) { | 184 if (UseMd()) { |
| 179 return gfx::CreateVectorIcon( | 185 return gfx::CreateVectorIcon( |
| 180 GetVectorIcon(), 16, | 186 GetVectorIcon(), 16, |
| 181 // When not checked, the icon color matches the button text color. | 187 // When not checked, the icon color matches the button text color. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 226 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
| 221 return ui::NativeTheme::kCheckbox; | 227 return ui::NativeTheme::kCheckbox; |
| 222 } | 228 } |
| 223 | 229 |
| 224 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 230 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
| 225 LabelButton::GetExtraParams(params); | 231 LabelButton::GetExtraParams(params); |
| 226 params->button.checked = checked_; | 232 params->button.checked = checked_; |
| 227 } | 233 } |
| 228 | 234 |
| 229 } // namespace views | 235 } // namespace views |
| OLD | NEW |