Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 2034963002: Rename InkDropHover to InkDropHighlight (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: relative patchset Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/base/material_design/material_design_controller.h" 15 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/gfx/animation/throb_animation.h" 16 #include "ui/gfx/animation/throb_animation.h"
17 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/color_utils.h" 18 #include "ui/gfx/color_utils.h"
19 #include "ui/gfx/font_list.h" 19 #include "ui/gfx/font_list.h"
20 #include "ui/gfx/geometry/vector2d.h" 20 #include "ui/gfx/geometry/vector2d.h"
21 #include "ui/native_theme/native_theme.h" 21 #include "ui/native_theme/native_theme.h"
22 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 22 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
23 #include "ui/views/animation/ink_drop_hover.h" 23 #include "ui/views/animation/ink_drop_highlight.h"
24 #include "ui/views/background.h" 24 #include "ui/views/background.h"
25 #include "ui/views/controls/button/label_button_border.h" 25 #include "ui/views/controls/button/label_button_border.h"
26 #include "ui/views/painter.h" 26 #include "ui/views/painter.h"
27 #include "ui/views/style/platform_style.h" 27 #include "ui/views/style/platform_style.h"
28 #include "ui/views/window/dialog_delegate.h" 28 #include "ui/views/window/dialog_delegate.h"
29 29
30 namespace { 30 namespace {
31 31
32 // The default spacing between the icon and text. 32 // The default spacing between the icon and text.
33 const int kSpacing = 5; 33 const int kSpacing = 5;
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ink_drop_container_->SetVisible(false); 420 ink_drop_container_->SetVisible(false);
421 } 421 }
422 422
423 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { 423 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const {
424 return GetText().empty() ? CustomButton::CreateInkDropRipple() 424 return GetText().empty() ? CustomButton::CreateInkDropRipple()
425 : base::WrapUnique(new views::FloodFillInkDropRipple( 425 : base::WrapUnique(new views::FloodFillInkDropRipple(
426 GetLocalBounds(), GetInkDropCenter(), 426 GetLocalBounds(), GetInkDropCenter(),
427 GetInkDropBaseColor())); 427 GetInkDropBaseColor()));
428 } 428 }
429 429
430 std::unique_ptr<views::InkDropHover> LabelButton::CreateInkDropHover() const { 430 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight()
431 if (!ShouldShowInkDropHover()) 431 const {
432 if (!ShouldShowInkDropHighlight())
432 return nullptr; 433 return nullptr;
433 return GetText().empty() ? CustomButton::CreateInkDropHover() 434 return GetText().empty() ? CustomButton::CreateInkDropHighlight()
434 : base::WrapUnique(new views::InkDropHover( 435 : base::WrapUnique(new views::InkDropHighlight(
435 size(), kInkDropSmallCornerRadius, 436 size(), kInkDropSmallCornerRadius,
436 GetInkDropCenter(), GetInkDropBaseColor())); 437 GetInkDropCenter(), GetInkDropBaseColor()));
437 } 438 }
438 439
439 gfx::Point LabelButton::GetInkDropCenter() const { 440 gfx::Point LabelButton::GetInkDropCenter() const {
440 // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent 441 // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent
441 // that triggered them. 442 // that triggered them.
442 return GetText().empty() ? image()->GetMirroredBounds().CenterPoint() 443 return GetText().empty() ? image()->GetMirroredBounds().CenterPoint()
443 : CustomButton::GetInkDropCenter(); 444 : CustomButton::GetInkDropCenter();
444 } 445 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 void LabelButton::ResetLabelEnabledColor() { 572 void LabelButton::ResetLabelEnabledColor() {
572 const SkColor color = 573 const SkColor color =
573 explicitly_set_colors_[state()] 574 explicitly_set_colors_[state()]
574 ? button_state_colors_[state()] 575 ? button_state_colors_[state()]
575 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 576 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
576 if (state() != STATE_DISABLED && label_->enabled_color() != color) 577 if (state() != STATE_DISABLED && label_->enabled_color() != color)
577 label_->SetEnabledColor(color); 578 label_->SetEnabledColor(color);
578 } 579 }
579 580
580 } // namespace views 581 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698