| 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/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/animation/throb_animation.h" | 10 #include "ui/gfx/animation/throb_animation.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 // Certain styles do not change text color when hovered or pressed. | 314 // Certain styles do not change text color when hovered or pressed. |
| 315 bool constant_text_color = false; | 315 bool constant_text_color = false; |
| 316 // Use hardcoded colors for inverted color scheme support and STYLE_BUTTON. | 316 // Use hardcoded colors for inverted color scheme support and STYLE_BUTTON. |
| 317 if (gfx::IsInvertedColorScheme()) { | 317 if (gfx::IsInvertedColorScheme()) { |
| 318 constant_text_color = true; | 318 constant_text_color = true; |
| 319 colors[STATE_NORMAL] = SK_ColorWHITE; | 319 colors[STATE_NORMAL] = SK_ColorWHITE; |
| 320 label_->SetBackgroundColor(SK_ColorBLACK); | 320 label_->SetBackgroundColor(SK_ColorBLACK); |
| 321 label_->set_background(Background::CreateSolidBackground(SK_ColorBLACK)); | 321 label_->set_background(Background::CreateSolidBackground(SK_ColorBLACK)); |
| 322 label_->SetAutoColorReadabilityEnabled(true); | 322 label_->SetAutoColorReadabilityEnabled(true); |
| 323 label_->ClearEmbellishing(); | 323 label_->set_shadows(gfx::ShadowValues()); |
| 324 } else if (style() == STYLE_BUTTON) { | 324 } else if (style() == STYLE_BUTTON) { |
| 325 // TODO(erg): This is disabled on desktop linux because of the binary asset | 325 // TODO(erg): This is disabled on desktop linux because of the binary asset |
| 326 // confusion. These details should either be pushed into ui::NativeThemeWin | 326 // confusion. These details should either be pushed into ui::NativeThemeWin |
| 327 // or should be obsoleted by rendering buttons with paint calls instead of | 327 // or should be obsoleted by rendering buttons with paint calls instead of |
| 328 // with static assets. http://crbug.com/350498 | 328 // with static assets. http://crbug.com/350498 |
| 329 #if !(defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 329 #if !(defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 330 constant_text_color = true; | 330 constant_text_color = true; |
| 331 colors[STATE_NORMAL] = kStyleButtonTextColor; | 331 colors[STATE_NORMAL] = kStyleButtonTextColor; |
| 332 label_->SetBackgroundColor(theme->GetSystemColor( | 332 label_->SetBackgroundColor(theme->GetSystemColor( |
| 333 ui::NativeTheme::kColorId_ButtonBackgroundColor)); | 333 ui::NativeTheme::kColorId_ButtonBackgroundColor)); |
| 334 label_->SetAutoColorReadabilityEnabled(false); | 334 label_->SetAutoColorReadabilityEnabled(false); |
| 335 label_->SetShadowColors(kStyleButtonShadowColor, kStyleButtonShadowColor); | 335 label_->set_shadows(gfx::ShadowValues(1, |
| 336 label_->SetShadowOffset(0, 1); | 336 gfx::ShadowValue(gfx::Point(0, 1), 0, kStyleButtonShadowColor))); |
| 337 #endif | 337 #endif |
| 338 label_->set_background(NULL); | 338 label_->set_background(NULL); |
| 339 } else { | 339 } else { |
| 340 label_->set_background(NULL); | 340 label_->set_background(NULL); |
| 341 } | 341 } |
| 342 | 342 |
| 343 if (constant_text_color) | 343 if (constant_text_color) |
| 344 colors[STATE_HOVERED] = colors[STATE_PRESSED] = colors[STATE_NORMAL]; | 344 colors[STATE_HOVERED] = colors[STATE_PRESSED] = colors[STATE_NORMAL]; |
| 345 | 345 |
| 346 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { | 346 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return ui::NativeTheme::kNormal; | 429 return ui::NativeTheme::kNormal; |
| 430 } | 430 } |
| 431 | 431 |
| 432 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 432 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
| 433 ui::NativeTheme::ExtraParams* params) const { | 433 ui::NativeTheme::ExtraParams* params) const { |
| 434 GetExtraParams(params); | 434 GetExtraParams(params); |
| 435 return ui::NativeTheme::kHovered; | 435 return ui::NativeTheme::kHovered; |
| 436 } | 436 } |
| 437 | 437 |
| 438 } // namespace views | 438 } // namespace views |
| OLD | NEW |