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

Side by Side Diff: ash/system/toast/toast_overlay.cc

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: rebase for r476345 Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/system/toast/toast_overlay.h" 5 #include "ash/system/toast/toast_overlay.h"
6 6
7 #include "ash/public/cpp/ash_typography.h" 7 #include "ash/public/cpp/ash_typography.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const int kToastMaximumWidth = 568; 46 const int kToastMaximumWidth = 568;
47 const int kToastMinimumWidth = 288; 47 const int kToastMinimumWidth = 288;
48 48
49 // Returns the work area bounds for the root window where new windows are added 49 // Returns the work area bounds for the root window where new windows are added
50 // (including new toasts). 50 // (including new toasts).
51 gfx::Rect GetUserWorkAreaBounds() { 51 gfx::Rect GetUserWorkAreaBounds() {
52 return Shelf::ForWindow(Shell::GetRootWindowForNewWindows()) 52 return Shelf::ForWindow(Shell::GetRootWindowForNewWindows())
53 ->GetUserWorkAreaBounds(); 53 ->GetUserWorkAreaBounds();
54 } 54 }
55 55
56 } // anonymous namespace
57
58 /////////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////////
59 // ToastOverlayLabel 57 // ToastOverlayLabel
60 class ToastOverlayLabel : public views::Label { 58 class ToastOverlayLabel : public views::Label {
61 public: 59 public:
62 explicit ToastOverlayLabel(const base::string16& label); 60 explicit ToastOverlayLabel(const base::string16& label);
63 ~ToastOverlayLabel() override; 61 ~ToastOverlayLabel() override;
64 62
65 private: 63 private:
66 DISALLOW_COPY_AND_ASSIGN(ToastOverlayLabel); 64 DISALLOW_COPY_AND_ASSIGN(ToastOverlayLabel);
67 }; 65 };
68 66
69 ToastOverlayLabel::ToastOverlayLabel(const base::string16& label) 67 ToastOverlayLabel::ToastOverlayLabel(const base::string16& label)
70 : Label(label, CONTEXT_TOAST_OVERLAY) { 68 : Label(label, CONTEXT_TOAST_OVERLAY) {
71 SetHorizontalAlignment(gfx::ALIGN_LEFT); 69 SetHorizontalAlignment(gfx::ALIGN_LEFT);
72 SetAutoColorReadabilityEnabled(false); 70 SetAutoColorReadabilityEnabled(false);
73 SetMultiLine(true); 71 SetMultiLine(true);
74 SetEnabledColor(SK_ColorWHITE); 72 SetEnabledColor(SK_ColorWHITE);
75 SetDisabledColor(SK_ColorWHITE);
76 SetSubpixelRenderingEnabled(false); 73 SetSubpixelRenderingEnabled(false);
77 74
78 int verticalSpacing = 75 int verticalSpacing =
79 kToastVerticalSpacing - (GetPreferredSize().height() - GetBaseline()); 76 kToastVerticalSpacing - (GetPreferredSize().height() - GetBaseline());
80 SetBorder(views::CreateEmptyBorder(verticalSpacing, kToastHorizontalSpacing, 77 SetBorder(views::CreateEmptyBorder(verticalSpacing, kToastHorizontalSpacing,
81 verticalSpacing, kToastHorizontalSpacing)); 78 verticalSpacing, kToastHorizontalSpacing));
82 } 79 }
83 80
84 ToastOverlayLabel::~ToastOverlayLabel() {} 81 ToastOverlayLabel::~ToastOverlayLabel() {}
85 82
83 } // namespace
84
86 /////////////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////////////
87 // ToastOverlayButton 86 // ToastOverlayButton
88 class ToastOverlayButton : public views::LabelButton { 87 class ToastOverlayButton : public views::LabelButton {
89 public: 88 public:
90 explicit ToastOverlayButton(views::ButtonListener* listener, 89 explicit ToastOverlayButton(views::ButtonListener* listener,
91 const base::string16& label); 90 const base::string16& label);
92 ~ToastOverlayButton() override {} 91 ~ToastOverlayButton() override {}
93 92
94 private: 93 private:
95 friend class ToastOverlay; // for ToastOverlay::ClickDismissButtonForTesting. 94 friend class ToastOverlay; // for ToastOverlay::ClickDismissButtonForTesting.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() { 288 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() {
290 return overlay_view_->button(); 289 return overlay_view_->button();
291 } 290 }
292 291
293 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { 292 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) {
294 DCHECK(overlay_view_->button()); 293 DCHECK(overlay_view_->button());
295 overlay_view_->button()->NotifyClick(event); 294 overlay_view_->button()->NotifyClick(event);
296 } 295 }
297 296
298 } // namespace ash 297 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698