| 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 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { | 167 std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { |
| 168 return CreateDefaultInkDropRipple(image()->bounds().CenterPoint()); | 168 return CreateDefaultInkDropRipple(image()->bounds().CenterPoint()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 std::unique_ptr<InkDropHighlight> Checkbox::CreateInkDropHighlight() const { | 171 std::unique_ptr<InkDropHighlight> Checkbox::CreateInkDropHighlight() const { |
| 172 return nullptr; | 172 return nullptr; |
| 173 } | 173 } |
| 174 | 174 |
| 175 SkColor Checkbox::GetInkDropBaseColor() const { | 175 SkColor Checkbox::GetInkDropBaseColor() const { |
| 176 return GetNativeTheme()->GetSystemColor( | 176 return GetNativeTheme()->GetSystemColor( |
| 177 ui::NativeTheme::kColorId_UnfocusedBorderColor); | 177 ui::NativeTheme::kColorId_ButtonEnabledColor); |
| 178 } | 178 } |
| 179 | 179 |
| 180 gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const { | 180 gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const { |
| 181 if (UseMd()) { | 181 if (UseMd()) { |
| 182 return gfx::CreateVectorIcon( | 182 return gfx::CreateVectorIcon( |
| 183 GetVectorIconId(), 16, | 183 GetVectorIconId(), 16, |
| 184 // When not checked, the icon color matches the button text color. | 184 // When not checked, the icon color matches the button text color. |
| 185 GetNativeTheme()->GetSystemColor( | 185 GetNativeTheme()->GetSystemColor( |
| 186 checked_ ? ui::NativeTheme::kColorId_CallToActionColor | 186 checked_ ? ui::NativeTheme::kColorId_FocusedBorderColor |
| 187 : ui::NativeTheme::kColorId_ButtonEnabledColor)); | 187 : ui::NativeTheme::kColorId_ButtonEnabledColor)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 const size_t checked_index = checked_ ? 1 : 0; | 190 const size_t checked_index = checked_ ? 1 : 0; |
| 191 const size_t focused_index = HasFocus() ? 1 : 0; | 191 const size_t focused_index = HasFocus() ? 1 : 0; |
| 192 if (for_state != STATE_NORMAL && | 192 if (for_state != STATE_NORMAL && |
| 193 images_[checked_index][focused_index][for_state].isNull()) | 193 images_[checked_index][focused_index][for_state].isNull()) |
| 194 return images_[checked_index][focused_index][STATE_NORMAL]; | 194 return images_[checked_index][focused_index][STATE_NORMAL]; |
| 195 return images_[checked_index][focused_index][for_state]; | 195 return images_[checked_index][focused_index][for_state]; |
| 196 } | 196 } |
| (...skipping 26 matching lines...) Expand all 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 |