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

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

Issue 2966063003: Reland of Use shared NotificationControlButtonsView for non-arc notification buttons (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 | ui/message_center/views/notification_view.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 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_control_buttons_view.h" 5 #include "ui/message_center/views/notification_control_buttons_view.h"
6 6
7 #include "ui/base/l10n/l10n_util.h" 7 #include "ui/base/l10n/l10n_util.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/gfx/animation/linear_animation.h" 10 #include "ui/gfx/animation/linear_animation.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 settings_button_->SetAccessibleName(l10n_util::GetStringUTF16( 73 settings_button_->SetAccessibleName(l10n_util::GetStringUTF16(
74 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME)); 74 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME));
75 settings_button_->SetTooltipText(l10n_util::GetStringUTF16( 75 settings_button_->SetTooltipText(l10n_util::GetStringUTF16(
76 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME)); 76 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME));
77 settings_button_->SetBackground( 77 settings_button_->SetBackground(
78 views::CreateSolidBackground(SK_ColorTRANSPARENT)); 78 views::CreateSolidBackground(SK_ColorTRANSPARENT));
79 79
80 // Add the button at the first. 80 // Add the button at the first.
81 DCHECK_LE(child_count(), 1); 81 DCHECK_LE(child_count(), 1);
82 AddChildViewAt(settings_button_, 0); 82 AddChildViewAt(settings_button_, 0);
83 } else if (!show && close_button_) { 83 } else if (!show && settings_button_) {
84 RemoveChildView(settings_button_); 84 RemoveChildView(settings_button_);
85 settings_button_ = nullptr; 85 settings_button_ = nullptr;
86 } 86 }
87 } 87 }
88 88
89 void NotificationControlButtonsView::SetBackgroundColor( 89 void NotificationControlButtonsView::SetBackgroundColor(
90 const SkColor& target_bgcolor) { 90 const SkColor& target_bgcolor) {
91 if (background()->get_color() != target_bgcolor) { 91 if (background()->get_color() != target_bgcolor) {
92 bgcolor_origin_ = background()->get_color(); 92 bgcolor_origin_ = background()->get_color();
93 bgcolor_target_ = target_bgcolor; 93 bgcolor_target_ = target_bgcolor;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const gfx::Animation* animation) { 147 const gfx::Animation* animation) {
148 // The animation is never cancelled explicitly. 148 // The animation is never cancelled explicitly.
149 NOTREACHED(); 149 NOTREACHED();
150 150
151 bgcolor_origin_ = bgcolor_target_; 151 bgcolor_origin_ = bgcolor_target_;
152 SetBackground(views::CreateSolidBackground(bgcolor_target_)); 152 SetBackground(views::CreateSolidBackground(bgcolor_target_));
153 SchedulePaint(); 153 SchedulePaint();
154 } 154 }
155 155
156 } // namespace message_center 156 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/views/notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698