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

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

Issue 2971123002: Adjust action button styling in MD 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/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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 214
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.
yoshiki 2017/07/07 02:50:53 could you add a brief comment about capitalization
tetsui 2017/07/07 04:00:19 Done.
224 class NotificationButtonMD : public views::LabelButton { 225 class NotificationButtonMD : public views::LabelButton {
225 public: 226 public:
226 NotificationButtonMD(views::ButtonListener* listener, 227 NotificationButtonMD(views::ButtonListener* listener,
227 const base::string16& text); 228 const base::string16& text);
228 ~NotificationButtonMD() override; 229 ~NotificationButtonMD() override;
229 230
231 void SetText(const base::string16& text) override;
232
230 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 233 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
231 const override; 234 const override;
232 235
233 private: 236 private:
234 DISALLOW_COPY_AND_ASSIGN(NotificationButtonMD); 237 DISALLOW_COPY_AND_ASSIGN(NotificationButtonMD);
235 }; 238 };
236 239
237 NotificationButtonMD::NotificationButtonMD(views::ButtonListener* listener, 240 NotificationButtonMD::NotificationButtonMD(views::ButtonListener* listener,
238 const base::string16& text) 241 const base::string16& text)
239 : views::LabelButton(listener, text, views::style::CONTEXT_BUTTON_MD) { 242 : views::LabelButton(listener,
243 base::i18n::ToUpper(text),
244 views::style::CONTEXT_BUTTON_MD) {
245 SetHorizontalAlignment(gfx::ALIGN_CENTER);
240 SetInkDropMode(views::LabelButton::InkDropMode::ON); 246 SetInkDropMode(views::LabelButton::InkDropMode::ON);
241 set_has_ink_drop_action_on_click(true); 247 set_has_ink_drop_action_on_click(true);
242 set_ink_drop_base_color(kActionButtonInkDropBaseColor); 248 set_ink_drop_base_color(kActionButtonInkDropBaseColor);
243 set_ink_drop_visible_opacity(kActionButtonInkDropRippleVisibleOpacity); 249 set_ink_drop_visible_opacity(kActionButtonInkDropRippleVisibleOpacity);
244 SetEnabledTextColors(kActionButtonTextColor); 250 SetEnabledTextColors(kActionButtonTextColor);
245 SetBorder(views::CreateEmptyBorder(kActionButtonPadding)); 251 SetBorder(views::CreateEmptyBorder(kActionButtonPadding));
246 SetMinSize(kActionButtonMinSize); 252 SetMinSize(kActionButtonMinSize);
247 SetFocusForPlatform(); 253 SetFocusForPlatform();
248 } 254 }
249 255
250 NotificationButtonMD::~NotificationButtonMD() = default; 256 NotificationButtonMD::~NotificationButtonMD() = default;
251 257
258 void NotificationButtonMD::SetText(const base::string16& text) {
259 views::LabelButton::SetText(base::i18n::ToUpper(text));
260 }
261
252 std::unique_ptr<views::InkDropHighlight> 262 std::unique_ptr<views::InkDropHighlight>
253 NotificationButtonMD::CreateInkDropHighlight() const { 263 NotificationButtonMD::CreateInkDropHighlight() const {
254 std::unique_ptr<views::InkDropHighlight> highlight = 264 std::unique_ptr<views::InkDropHighlight> highlight =
255 views::LabelButton::CreateInkDropHighlight(); 265 views::LabelButton::CreateInkDropHighlight();
256 highlight->set_visible_opacity(kActionButtonInkDropHighlightVisibleOpacity); 266 highlight->set_visible_opacity(kActionButtonInkDropHighlightVisibleOpacity);
257 return highlight; 267 return highlight;
258 } 268 }
259 269
260 } // anonymous namespace 270 } // anonymous namespace
261 271
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 header_row_->expand_button()->HasFocus()) || 778 header_row_->expand_button()->HasFocus()) ||
769 (header_row_->IsCloseButtonEnabled() && 779 (header_row_->IsCloseButtonEnabled() &&
770 header_row_->close_button()->HasFocus()) || 780 header_row_->close_button()->HasFocus()) ||
771 (header_row_->IsSettingsButtonEnabled() && 781 (header_row_->IsSettingsButtonEnabled() &&
772 header_row_->settings_button()->HasFocus()); 782 header_row_->settings_button()->HasFocus());
773 783
774 header_row_->SetControlButtonsVisible(target_visibility); 784 header_row_->SetControlButtonsVisible(target_visibility);
775 } 785 }
776 786
777 } // namespace message_center 787 } // 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