| 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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 scoped_ptr<LabelButtonBorder> label_button_border = CreateDefaultBorder(); | 437 scoped_ptr<LabelButtonBorder> label_button_border = CreateDefaultBorder(); |
| 438 | 438 |
| 439 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 439 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 440 views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 440 views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
| 441 if (linux_ui) { | 441 if (linux_ui) { |
| 442 SetBorder(linux_ui->CreateNativeBorder( | 442 SetBorder(linux_ui->CreateNativeBorder( |
| 443 this, label_button_border.Pass())); | 443 this, label_button_border.Pass())); |
| 444 } else | 444 } else |
| 445 #endif | 445 #endif |
| 446 { | 446 { |
| 447 SetBorder(label_button_border.PassAs<Border>()); | 447 SetBorder(label_button_border.Pass()); |
| 448 } | 448 } |
| 449 | 449 |
| 450 border_is_themed_border_ = true; | 450 border_is_themed_border_ = true; |
| 451 } | 451 } |
| 452 | 452 |
| 453 void LabelButton::StateChanged() { | 453 void LabelButton::StateChanged() { |
| 454 const gfx::Size previous_image_size(image_->GetPreferredSize()); | 454 const gfx::Size previous_image_size(image_->GetPreferredSize()); |
| 455 UpdateImage(); | 455 UpdateImage(); |
| 456 const SkColor color = button_state_colors_[state()]; | 456 const SkColor color = button_state_colors_[state()]; |
| 457 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 457 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 GetExtraParams(params); | 509 GetExtraParams(params); |
| 510 return ui::NativeTheme::kHovered; | 510 return ui::NativeTheme::kHovered; |
| 511 } | 511 } |
| 512 | 512 |
| 513 void LabelButton::ResetCachedPreferredSize() { | 513 void LabelButton::ResetCachedPreferredSize() { |
| 514 cached_preferred_size_valid_ = false; | 514 cached_preferred_size_valid_ = false; |
| 515 cached_preferred_size_= gfx::Size(); | 515 cached_preferred_size_= gfx::Size(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace views | 518 } // namespace views |
| OLD | NEW |