| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "ui/gfx/animation/throb_animation.h" | 15 #include "ui/gfx/animation/throb_animation.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/color_utils.h" | 17 #include "ui/gfx/color_utils.h" |
| 17 #include "ui/gfx/font_list.h" | 18 #include "ui/gfx/font_list.h" |
| 18 #include "ui/gfx/geometry/vector2d.h" | 19 #include "ui/gfx/geometry/vector2d.h" |
| 19 #include "ui/native_theme/native_theme.h" | 20 #include "ui/native_theme/native_theme.h" |
| 20 #include "ui/views/animation/flood_fill_ink_drop_animation.h" | 21 #include "ui/views/animation/flood_fill_ink_drop_animation.h" |
| 21 #include "ui/views/animation/ink_drop_hover.h" | 22 #include "ui/views/animation/ink_drop_hover.h" |
| 22 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 image()->SetPaintToLayer(false); | 412 image()->SetPaintToLayer(false); |
| 412 ink_drop_container_->layer()->Remove(ink_drop_layer); | 413 ink_drop_container_->layer()->Remove(ink_drop_layer); |
| 413 ink_drop_container_->SetVisible(false); | 414 ink_drop_container_->SetVisible(false); |
| 414 } | 415 } |
| 415 | 416 |
| 416 scoped_ptr<views::InkDropAnimation> LabelButton::CreateInkDropAnimation() | 417 scoped_ptr<views::InkDropAnimation> LabelButton::CreateInkDropAnimation() |
| 417 const { | 418 const { |
| 418 return GetText().empty() | 419 return GetText().empty() |
| 419 ? CustomButton::CreateInkDropAnimation() | 420 ? CustomButton::CreateInkDropAnimation() |
| 420 : make_scoped_ptr(new views::FloodFillInkDropAnimation( | 421 : make_scoped_ptr(new views::FloodFillInkDropAnimation( |
| 421 size(), GetInkDropCenter(), GetInkDropBaseColor())); | 422 GetLocalBounds(), GetInkDropCenter(), |
| 423 GetInkDropBaseColor())); |
| 422 } | 424 } |
| 423 | 425 |
| 424 scoped_ptr<views::InkDropHover> LabelButton::CreateInkDropHover() const { | 426 scoped_ptr<views::InkDropHover> LabelButton::CreateInkDropHover() const { |
| 425 if (!ShouldShowInkDropHover()) | 427 if (!ShouldShowInkDropHover()) |
| 426 return nullptr; | 428 return nullptr; |
| 427 return GetText().empty() ? CustomButton::CreateInkDropHover() | 429 return GetText().empty() ? CustomButton::CreateInkDropHover() |
| 428 : make_scoped_ptr(new views::InkDropHover( | 430 : make_scoped_ptr(new views::InkDropHover( |
| 429 size(), kInkDropSmallCornerRadius, | 431 size(), kInkDropSmallCornerRadius, |
| 430 GetInkDropCenter(), GetInkDropBaseColor())); | 432 GetInkDropCenter(), GetInkDropBaseColor())); |
| 431 } | 433 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 GetExtraParams(params); | 569 GetExtraParams(params); |
| 568 return ui::NativeTheme::kHovered; | 570 return ui::NativeTheme::kHovered; |
| 569 } | 571 } |
| 570 | 572 |
| 571 void LabelButton::ResetCachedPreferredSize() { | 573 void LabelButton::ResetCachedPreferredSize() { |
| 572 cached_preferred_size_valid_ = false; | 574 cached_preferred_size_valid_ = false; |
| 573 cached_preferred_size_ = gfx::Size(); | 575 cached_preferred_size_ = gfx::Size(); |
| 574 } | 576 } |
| 575 | 577 |
| 576 } // namespace views | 578 } // namespace views |
| OLD | NEW |