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

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

Issue 2971123002: Adjust action button styling in MD notification. (Closed)
Patch Set: Add comment. 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/i18n/case_conversion.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "ui/base/cursor/cursor.h" 11 #include "ui/base/cursor/cursor.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/image/image_skia_operations.h" 15 #include "ui/gfx/image/image_skia_operations.h"
15 #include "ui/gfx/paint_vector_icon.h" 16 #include "ui/gfx/paint_vector_icon.h"
16 #include "ui/gfx/skia_util.h" 17 #include "ui/gfx/skia_util.h"
17 #include "ui/gfx/text_elider.h" 18 #include "ui/gfx/text_elider.h"
18 #include "ui/message_center/message_center.h" 19 #include "ui/message_center/message_center.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 title_view_->SetText(title); 215 title_view_->SetText(title);
215 message_view_->SetText(message); 216 message_view_->SetText(message);
216 217
217 views::View::OnPaint(canvas); 218 views::View::OnPaint(canvas);
218 } 219 }
219 220
220 // NotificationButtonMD //////////////////////////////////////////////////////// 221 // NotificationButtonMD ////////////////////////////////////////////////////////
221 222
222 // This class is needed in addition to LabelButton mainly becuase we want to set 223 // This class is needed in addition to LabelButton mainly becuase we want to set
223 // visible_opacity of InkDropHighlight. 224 // visible_opacity of InkDropHighlight.
225 // This button capitalizes the given label string.
224 class NotificationButtonMD : public views::LabelButton { 226 class NotificationButtonMD : public views::LabelButton {
225 public: 227 public:
226 NotificationButtonMD(views::ButtonListener* listener, 228 NotificationButtonMD(views::ButtonListener* listener,
227 const base::string16& text); 229 const base::string16& text);
228 ~NotificationButtonMD() override; 230 ~NotificationButtonMD() override;
229 231
232 void SetText(const base::string16& text) override;
233
230 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 234 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
231 const override; 235 const override;
232 236
233 private: 237 private:
234 DISALLOW_COPY_AND_ASSIGN(NotificationButtonMD); 238 DISALLOW_COPY_AND_ASSIGN(NotificationButtonMD);
235 }; 239 };
236 240
237 NotificationButtonMD::NotificationButtonMD(views::ButtonListener* listener, 241 NotificationButtonMD::NotificationButtonMD(views::ButtonListener* listener,
238 const base::string16& text) 242 const base::string16& text)
239 : views::LabelButton(listener, text, views::style::CONTEXT_BUTTON_MD) { 243 : views::LabelButton(listener,
244 base::i18n::ToUpper(text),
245 views::style::CONTEXT_BUTTON_MD) {
246 SetHorizontalAlignment(gfx::ALIGN_CENTER);
240 SetInkDropMode(views::LabelButton::InkDropMode::ON); 247 SetInkDropMode(views::LabelButton::InkDropMode::ON);
241 set_has_ink_drop_action_on_click(true); 248 set_has_ink_drop_action_on_click(true);
242 set_ink_drop_base_color(kActionButtonInkDropBaseColor); 249 set_ink_drop_base_color(kActionButtonInkDropBaseColor);
243 set_ink_drop_visible_opacity(kActionButtonInkDropRippleVisibleOpacity); 250 set_ink_drop_visible_opacity(kActionButtonInkDropRippleVisibleOpacity);
244 SetEnabledTextColors(kActionButtonTextColor); 251 SetEnabledTextColors(kActionButtonTextColor);
245 SetBorder(views::CreateEmptyBorder(kActionButtonPadding)); 252 SetBorder(views::CreateEmptyBorder(kActionButtonPadding));
246 SetMinSize(kActionButtonMinSize); 253 SetMinSize(kActionButtonMinSize);
247 SetFocusForPlatform(); 254 SetFocusForPlatform();
248 } 255 }
249 256
250 NotificationButtonMD::~NotificationButtonMD() = default; 257 NotificationButtonMD::~NotificationButtonMD() = default;
251 258
259 void NotificationButtonMD::SetText(const base::string16& text) {
260 views::LabelButton::SetText(base::i18n::ToUpper(text));
261 }
262
252 std::unique_ptr<views::InkDropHighlight> 263 std::unique_ptr<views::InkDropHighlight>
253 NotificationButtonMD::CreateInkDropHighlight() const { 264 NotificationButtonMD::CreateInkDropHighlight() const {
254 std::unique_ptr<views::InkDropHighlight> highlight = 265 std::unique_ptr<views::InkDropHighlight> highlight =
255 views::LabelButton::CreateInkDropHighlight(); 266 views::LabelButton::CreateInkDropHighlight();
256 highlight->set_visible_opacity(kActionButtonInkDropHighlightVisibleOpacity); 267 highlight->set_visible_opacity(kActionButtonInkDropHighlightVisibleOpacity);
257 return highlight; 268 return highlight;
258 } 269 }
259 270
260 } // anonymous namespace 271 } // anonymous namespace
261 272
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 header_row_->expand_button()->HasFocus()) || 779 header_row_->expand_button()->HasFocus()) ||
769 (header_row_->IsCloseButtonEnabled() && 780 (header_row_->IsCloseButtonEnabled() &&
770 header_row_->close_button()->HasFocus()) || 781 header_row_->close_button()->HasFocus()) ||
771 (header_row_->IsSettingsButtonEnabled() && 782 (header_row_->IsSettingsButtonEnabled() &&
772 header_row_->settings_button()->HasFocus()); 783 header_row_->settings_button()->HasFocus());
773 784
774 header_row_->SetControlButtonsVisible(target_visibility); 785 header_row_->SetControlButtonsVisible(target_visibility);
775 } 786 }
776 787
777 } // namespace message_center 788 } // 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