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

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

Issue 2960393002: Hardcode ripple color/opacity for Harmony. (Closed)
Patch Set: Consolidate FloodFill as well Created 3 years, 5 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
« no previous file with comments | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gfx/animation/throb_animation.h" 15 #include "ui/gfx/animation/throb_animation.h"
16 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
17 #include "ui/gfx/color_utils.h" 17 #include "ui/gfx/color_utils.h"
18 #include "ui/gfx/font_list.h" 18 #include "ui/gfx/font_list.h"
19 #include "ui/gfx/geometry/vector2d.h" 19 #include "ui/gfx/geometry/vector2d.h"
20 #include "ui/native_theme/native_theme.h" 20 #include "ui/native_theme/native_theme.h"
21 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
22 #include "ui/views/animation/ink_drop.h" 21 #include "ui/views/animation/ink_drop.h"
23 #include "ui/views/animation/ink_drop_highlight.h" 22 #include "ui/views/animation/ink_drop_highlight.h"
24 #include "ui/views/animation/ink_drop_impl.h" 23 #include "ui/views/animation/ink_drop_impl.h"
25 #include "ui/views/animation/square_ink_drop_ripple.h" 24 #include "ui/views/animation/ink_drop_ripple.h"
26 #include "ui/views/background.h" 25 #include "ui/views/background.h"
27 #include "ui/views/controls/button/label_button_border.h" 26 #include "ui/views/controls/button/label_button_border.h"
28 #include "ui/views/controls/button/label_button_label.h" 27 #include "ui/views/controls/button/label_button_label.h"
29 #include "ui/views/layout/layout_provider.h" 28 #include "ui/views/layout/layout_provider.h"
30 #include "ui/views/painter.h" 29 #include "ui/views/painter.h"
31 #include "ui/views/style/platform_style.h" 30 #include "ui/views/style/platform_style.h"
32 #include "ui/views/window/dialog_delegate.h" 31 #include "ui/views/window/dialog_delegate.h"
33 32
34 namespace views { 33 namespace views {
35 34
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 image()->DestroyLayer(); 371 image()->DestroyLayer();
373 ResetInkDropMask(); 372 ResetInkDropMask();
374 ink_drop_container_->RemoveInkDropLayer(ink_drop_layer); 373 ink_drop_container_->RemoveInkDropLayer(ink_drop_layer);
375 } 374 }
376 375
377 std::unique_ptr<InkDrop> LabelButton::CreateInkDrop() { 376 std::unique_ptr<InkDrop> LabelButton::CreateInkDrop() {
378 return ShouldUseFloodFillInkDrop() ? CreateDefaultFloodFillInkDropImpl() 377 return ShouldUseFloodFillInkDrop() ? CreateDefaultFloodFillInkDropImpl()
379 : CustomButton::CreateInkDrop(); 378 : CustomButton::CreateInkDrop();
380 } 379 }
381 380
382 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { 381 std::unique_ptr<InkDropRipple> LabelButton::CreateInkDropRipple() const {
383 return ShouldUseFloodFillInkDrop() 382 return ShouldUseFloodFillInkDrop()
384 ? base::MakeUnique<views::FloodFillInkDropRipple>( 383 ? CreateFloodFillInkDropRipple()
385 size(), GetInkDropCenterBasedOnLastEvent(),
386 GetInkDropBaseColor(), ink_drop_visible_opacity())
387 : CreateDefaultInkDropRipple( 384 : CreateDefaultInkDropRipple(
388 image()->GetMirroredBounds().CenterPoint()); 385 image()->GetMirroredBounds().CenterPoint());
389 } 386 }
390 387
391 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() 388 std::unique_ptr<InkDropHighlight> LabelButton::CreateInkDropHighlight() const {
392 const {
393 return ShouldUseFloodFillInkDrop() 389 return ShouldUseFloodFillInkDrop()
394 ? base::MakeUnique<views::InkDropHighlight>( 390 ? base::MakeUnique<InkDropHighlight>(
395 size(), kInkDropSmallCornerRadius, 391 size(), kInkDropSmallCornerRadius,
396 gfx::RectF(GetLocalBounds()).CenterPoint(), 392 gfx::RectF(GetLocalBounds()).CenterPoint(),
397 GetInkDropBaseColor()) 393 GetInkDropBaseColor())
398 : CreateDefaultInkDropHighlight( 394 : CreateDefaultInkDropHighlight(
399 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()); 395 gfx::RectF(image()->GetMirroredBounds()).CenterPoint());
400 } 396 }
401 397
402 void LabelButton::StateChanged(ButtonState old_state) { 398 void LabelButton::StateChanged(ButtonState old_state) {
403 const gfx::Size previous_image_size(image_->GetPreferredSize()); 399 const gfx::Size previous_image_size(image_->GetPreferredSize());
404 UpdateImage(); 400 UpdateImage();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 void LabelButton::ResetLabelEnabledColor() { 545 void LabelButton::ResetLabelEnabledColor() {
550 const SkColor color = 546 const SkColor color =
551 explicitly_set_colors_[state()] 547 explicitly_set_colors_[state()]
552 ? button_state_colors_[state()] 548 ? button_state_colors_[state()]
553 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 549 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
554 if (state() != STATE_DISABLED && label_->enabled_color() != color) 550 if (state() != STATE_DISABLED && label_->enabled_color() != color)
555 label_->SetEnabledColor(color); 551 label_->SetEnabledColor(color);
556 } 552 }
557 553
558 } // namespace views 554 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698