| OLD | NEW | 
|---|
| 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/screen_util.h" | 7 #include "ash/screen_util.h" | 
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" | 
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" | 
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 109 //  ToastOverlayButton | 109 //  ToastOverlayButton | 
| 110 class ToastOverlayButton : public views::LabelButton { | 110 class ToastOverlayButton : public views::LabelButton { | 
| 111  public: | 111  public: | 
| 112   explicit ToastOverlayButton(views::ButtonListener* listener, | 112   explicit ToastOverlayButton(views::ButtonListener* listener, | 
| 113                               const base::string16& label); | 113                               const base::string16& label); | 
| 114   ~ToastOverlayButton() override {} | 114   ~ToastOverlayButton() override {} | 
| 115 | 115 | 
| 116  private: | 116  private: | 
| 117   friend class ToastOverlay;  // for ToastOverlay::ClickDismissButtonForTesting. | 117   friend class ToastOverlay;  // for ToastOverlay::ClickDismissButtonForTesting. | 
| 118 | 118 | 
| 119   // Controls the visual feedback for the button state. |  | 
| 120   std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; |  | 
| 121 |  | 
| 122   DISALLOW_COPY_AND_ASSIGN(ToastOverlayButton); | 119   DISALLOW_COPY_AND_ASSIGN(ToastOverlayButton); | 
| 123 }; | 120 }; | 
| 124 | 121 | 
| 125 ToastOverlayButton::ToastOverlayButton(views::ButtonListener* listener, | 122 ToastOverlayButton::ToastOverlayButton(views::ButtonListener* listener, | 
| 126                                        const base::string16& text) | 123                                        const base::string16& text) | 
| 127     : views::LabelButton(listener, text), | 124     : views::LabelButton(listener, text) { | 
| 128       ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)) { | 125   set_ink_drop_delegate( | 
| 129   set_ink_drop_delegate(ink_drop_delegate_.get()); | 126       base::WrapUnique(new views::ButtonInkDropDelegate(this, this))); | 
| 130   set_has_ink_drop_action_on_click(true); | 127   set_has_ink_drop_action_on_click(true); | 
| 131   set_ink_drop_base_color(SK_ColorWHITE); | 128   set_ink_drop_base_color(SK_ColorWHITE); | 
| 132 | 129 | 
| 133   ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 130   ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 
| 134 | 131 | 
| 135   SetEnabledTextColors(kButtonTextColor); | 132   SetEnabledTextColors(kButtonTextColor); | 
| 136   SetFontList(rb->GetFontList(kTextFontStyle)); | 133   SetFontList(rb->GetFontList(kTextFontStyle)); | 
| 137 | 134 | 
| 138   // Treat the space below the baseline as a margin. | 135   // Treat the space below the baseline as a margin. | 
| 139   int verticalSpacing = kToastVerticalSpacing - | 136   int verticalSpacing = kToastVerticalSpacing - | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 293 | 290 | 
| 294 views::Widget* ToastOverlay::widget_for_testing() { | 291 views::Widget* ToastOverlay::widget_for_testing() { | 
| 295   return overlay_widget_.get(); | 292   return overlay_widget_.get(); | 
| 296 } | 293 } | 
| 297 | 294 | 
| 298 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 295 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 
| 299   overlay_view_->button()->NotifyClick(event); | 296   overlay_view_->button()->NotifyClick(event); | 
| 300 } | 297 } | 
| 301 | 298 | 
| 302 }  // namespace ash | 299 }  // namespace ash | 
| OLD | NEW | 
|---|