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/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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 void LabelButton::UpdateThemedBorder() { | 358 void LabelButton::UpdateThemedBorder() { |
| 359 // Don't override borders set by others. | 359 // Don't override borders set by others. |
| 360 if (!border_is_themed_border_) | 360 if (!border_is_themed_border_) |
| 361 return; | 361 return; |
| 362 | 362 |
| 363 scoped_ptr<Border> label_button_border = CreateDefaultBorder(); | 363 scoped_ptr<Border> label_button_border = CreateDefaultBorder(); |
| 364 | 364 |
| 365 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 365 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 366 views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 366 views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
| 367 if (linux_ui) { | 367 if (linux_ui) { |
| 368 Border* default_border = label_button_border.get(); | |
| 368 SetBorder(linux_ui->CreateNativeBorder(this, label_button_border.Pass())); | 369 SetBorder(linux_ui->CreateNativeBorder(this, label_button_border.Pass())); |
| 370 label_->SetBackgroundColor(GetNativeTheme()->GetSystemColor( | |
| 371 ui::NativeTheme::kColorId_ButtonBackgroundColor)); | |
| 372 // If we're using a system-themed border, make sure text is legible. | |
| 373 label_->SetAutoColorReadabilityEnabled(border() != default_border); | |
|
Elliot Glaysher
2014/05/23 21:07:01
Do we want to be executing all this outside of Blu
Evan Stade
2014/05/23 23:39:53
I guess I get why you're asking -- because normal
| |
| 369 } else | 374 } else |
| 370 #endif | 375 #endif |
| 371 { | 376 { |
| 372 SetBorder(label_button_border.Pass()); | 377 SetBorder(label_button_border.Pass()); |
| 373 } | 378 } |
| 374 | 379 |
| 375 border_is_themed_border_ = true; | 380 border_is_themed_border_ = true; |
| 376 } | 381 } |
| 377 | 382 |
| 378 void LabelButton::StateChanged() { | 383 void LabelButton::StateChanged() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 return ui::NativeTheme::kNormal; | 433 return ui::NativeTheme::kNormal; |
| 429 } | 434 } |
| 430 | 435 |
| 431 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 436 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
| 432 ui::NativeTheme::ExtraParams* params) const { | 437 ui::NativeTheme::ExtraParams* params) const { |
| 433 GetExtraParams(params); | 438 GetExtraParams(params); |
| 434 return ui::NativeTheme::kHovered; | 439 return ui::NativeTheme::kHovered; |
| 435 } | 440 } |
| 436 | 441 |
| 437 } // namespace views | 442 } // namespace views |
| OLD | NEW |