| 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_view_state.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/gfx/vector_icons_public.h" | 17 #include "ui/gfx/vector_icons_public.h" |
| 18 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
| 19 #include "ui/views/animation/ink_drop_highlight.h" | 19 #include "ui/views/animation/ink_drop_highlight.h" |
| 20 #include "ui/views/animation/ink_drop_ripple.h" | 20 #include "ui/views/animation/ink_drop_ripple.h" |
| 21 #include "ui/views/controls/button/label_button_border.h" | 21 #include "ui/views/controls/button/label_button_border.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 rect.Inset(-2, 3); | 115 rect.Inset(-2, 3); |
| 116 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( | 116 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( |
| 117 rect.y(), rect.x(), height() - rect.bottom(), width() - rect.right()))); | 117 rect.y(), rect.x(), height() - rect.bottom(), width() - rect.right()))); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 const char* Checkbox::GetClassName() const { | 121 const char* Checkbox::GetClassName() const { |
| 122 return kViewClassName; | 122 return kViewClassName; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void Checkbox::GetAccessibleState(ui::AXViewState* state) { | 125 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 126 LabelButton::GetAccessibleState(state); | 126 LabelButton::GetAccessibleNodeData(node_data); |
| 127 state->role = ui::AX_ROLE_CHECK_BOX; | 127 node_data->role = ui::AX_ROLE_CHECK_BOX; |
| 128 if (checked()) | 128 if (checked()) |
| 129 state->AddStateFlag(ui::AX_STATE_CHECKED); | 129 node_data->AddStateFlag(ui::AX_STATE_CHECKED); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void Checkbox::OnPaint(gfx::Canvas* canvas) { | 132 void Checkbox::OnPaint(gfx::Canvas* canvas) { |
| 133 LabelButton::OnPaint(canvas); | 133 LabelButton::OnPaint(canvas); |
| 134 | 134 |
| 135 if (!UseMd() || !HasFocus()) | 135 if (!UseMd() || !HasFocus()) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 SkPaint focus_paint; | 138 SkPaint focus_paint; |
| 139 focus_paint.setAntiAlias(true); | 139 focus_paint.setAntiAlias(true); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 223 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
| 224 return ui::NativeTheme::kCheckbox; | 224 return ui::NativeTheme::kCheckbox; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 227 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
| 228 LabelButton::GetExtraParams(params); | 228 LabelButton::GetExtraParams(params); |
| 229 params->button.checked = checked_; | 229 params->button.checked = checked_; |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace views | 232 } // namespace views |
| OLD | NEW |