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

Side by Side Diff: ui/message_center/views/notification_view_md.cc

Issue 2958963002: Add ripple effect to action buttons in new-style notification. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/message_center/views/notification_view_md.h" 5 #include "ui/message_center/views/notification_view_md.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/base/cursor/cursor.h" 10 #include "ui/base/cursor/cursor.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace message_center { 43 namespace message_center {
44 44
45 namespace { 45 namespace {
46 46
47 // Dimensions. 47 // Dimensions.
48 constexpr gfx::Insets kContentRowPadding(4, 12, 12, 12); 48 constexpr gfx::Insets kContentRowPadding(4, 12, 12, 12);
49 constexpr gfx::Insets kActionsRowPadding(8, 8, 8, 8); 49 constexpr gfx::Insets kActionsRowPadding(8, 8, 8, 8);
50 constexpr int kActionsRowHorizontalSpacing = 8; 50 constexpr int kActionsRowHorizontalSpacing = 8;
51 constexpr gfx::Insets kImageContainerPadding(0, 12, 12, 12); 51 constexpr gfx::Insets kImageContainerPadding(0, 12, 12, 12);
52 constexpr gfx::Insets kActionButtonPadding(0, 12, 0, 12);
53 constexpr gfx::Size kActionButtonMinSize(88, 32);
52 54
53 // Foreground of small icon image. 55 // Foreground of small icon image.
54 constexpr SkColor kSmallImageBackgroundColor = SK_ColorWHITE; 56 constexpr SkColor kSmallImageBackgroundColor = SK_ColorWHITE;
55 // Background of small icon image. 57 // Background of small icon image.
56 const SkColor kSmallImageColor = SkColorSetRGB(0x43, 0x43, 0x43); 58 const SkColor kSmallImageColor = SkColorSetRGB(0x43, 0x43, 0x43);
57 // Background of inline actions area. 59 // Background of inline actions area.
58 const SkColor kActionsRowBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee); 60 const SkColor kActionsRowBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee);
61 // Ink drop color of action buttons.
62 const SkColor kActionButtonInkDropBaseColor = SkColorSetRGB(0x0, 0x0, 0x0);
63 // Ink drop opacity of action buttons when the ripple is visible.
64 const float kActionButtonInkDropVisibleOpacity = 0.08f;
65 // Text color of action button.
66 const SkColor kActionButtonTextColor = SkColorSetRGB(0x33, 0x67, 0xD6);
59 67
60 // Max number of lines for message_view_. 68 // Max number of lines for message_view_.
61 constexpr int kMaxLinesForMessageView = 1; 69 constexpr int kMaxLinesForMessageView = 1;
62 constexpr int kMaxLinesForExpandedMessageView = 4; 70 constexpr int kMaxLinesForExpandedMessageView = 4;
63 71
64 constexpr int kListNotificationOverflowIndicatorSpacing = 4; 72 constexpr int kListNotificationOverflowIndicatorSpacing = 4;
65 constexpr int kCompactTitleMessageViewSpacing = 12; 73 constexpr int kCompactTitleMessageViewSpacing = 12;
66 74
67 constexpr int kProgressBarHeight = 4; 75 constexpr int kProgressBarHeight = 4;
68 76
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 action_buttons_.clear(); 680 action_buttons_.clear();
673 } 681 }
674 682
675 DCHECK_EQ(this, actions_row_->parent()); 683 DCHECK_EQ(this, actions_row_->parent());
676 684
677 for (size_t i = 0; i < buttons.size(); ++i) { 685 for (size_t i = 0; i < buttons.size(); ++i) {
678 ButtonInfo button_info = buttons[i]; 686 ButtonInfo button_info = buttons[i];
679 if (new_buttons) { 687 if (new_buttons) {
680 views::LabelButton* button = new views::LabelButton( 688 views::LabelButton* button = new views::LabelButton(
681 this, button_info.title, views::style::CONTEXT_BUTTON_MD); 689 this, button_info.title, views::style::CONTEXT_BUTTON_MD);
690 button->SetInkDropMode(views::LabelButton::InkDropMode::ON);
691 button->set_has_ink_drop_action_on_click(true);
692 // TODO(tetsui): Hover background color is slightly different from the
693 // mock. Investigate how to set hover color and ripple color separately.
fukino 2017/06/28 02:11:57 (record from offline discussion) As this change is
tetsui 2017/06/28 06:30:24 Done. Hover color is precisely accurate. Ripple co
694 button->set_ink_drop_base_color(kActionButtonInkDropBaseColor);
695 button->set_ink_drop_visible_opacity(kActionButtonInkDropVisibleOpacity);
696 button->SetEnabledTextColors(kActionButtonTextColor);
697 button->SetBorder(views::CreateEmptyBorder(kActionButtonPadding));
698 button->SetMinSize(kActionButtonMinSize);
682 button->SetFocusForPlatform(); 699 button->SetFocusForPlatform();
683 action_buttons_.push_back(button); 700 action_buttons_.push_back(button);
684 actions_row_->AddChildView(button); 701 actions_row_->AddChildView(button);
685 } else { 702 } else {
686 action_buttons_[i]->SetText(button_info.title); 703 action_buttons_[i]->SetText(button_info.title);
687 action_buttons_[i]->SchedulePaint(); 704 action_buttons_[i]->SchedulePaint();
688 action_buttons_[i]->Layout(); 705 action_buttons_[i]->Layout();
689 } 706 }
690 } 707 }
691 708
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 header_row_->expand_button()->HasFocus()) || 790 header_row_->expand_button()->HasFocus()) ||
774 (header_row_->IsCloseButtonEnabled() && 791 (header_row_->IsCloseButtonEnabled() &&
775 header_row_->close_button()->HasFocus()) || 792 header_row_->close_button()->HasFocus()) ||
776 (header_row_->IsSettingsButtonEnabled() && 793 (header_row_->IsSettingsButtonEnabled() &&
777 header_row_->settings_button()->HasFocus()); 794 header_row_->settings_button()->HasFocus());
778 795
779 header_row_->SetControlButtonsVisible(target_visibility); 796 header_row_->SetControlButtonsVisible(target_visibility);
780 } 797 }
781 798
782 } // namespace message_center 799 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698