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/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/wm/window_animations.h" | 12 #include "ash/wm/window_animations.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "grit/ash_strings.h" | 16 #include "grit/ash_strings.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/font_list.h" | 21 #include "ui/gfx/font_list.h" |
22 #include "ui/views/animation/button_ink_drop_delegate.h" | |
23 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
24 #include "ui/views/controls/button/label_button.h" | 23 #include "ui/views/controls/button/label_button.h" |
25 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
26 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
27 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
28 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
29 #include "ui/views/widget/widget_delegate.h" | 28 #include "ui/views/widget/widget_delegate.h" |
30 | 29 |
31 namespace ash { | 30 namespace ash { |
32 | 31 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 114 |
116 private: | 115 private: |
117 friend class ToastOverlay; // for ToastOverlay::ClickDismissButtonForTesting. | 116 friend class ToastOverlay; // for ToastOverlay::ClickDismissButtonForTesting. |
118 | 117 |
119 DISALLOW_COPY_AND_ASSIGN(ToastOverlayButton); | 118 DISALLOW_COPY_AND_ASSIGN(ToastOverlayButton); |
120 }; | 119 }; |
121 | 120 |
122 ToastOverlayButton::ToastOverlayButton(views::ButtonListener* listener, | 121 ToastOverlayButton::ToastOverlayButton(views::ButtonListener* listener, |
123 const base::string16& text) | 122 const base::string16& text) |
124 : views::LabelButton(listener, text) { | 123 : views::LabelButton(listener, text) { |
125 set_ink_drop_delegate( | 124 SetHasInkDrop(true); |
126 base::WrapUnique(new views::ButtonInkDropDelegate(this, this))); | |
127 set_has_ink_drop_action_on_click(true); | 125 set_has_ink_drop_action_on_click(true); |
128 set_ink_drop_base_color(SK_ColorWHITE); | 126 set_ink_drop_base_color(SK_ColorWHITE); |
129 | 127 |
130 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 128 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
131 | 129 |
132 SetEnabledTextColors(kButtonTextColor); | 130 SetEnabledTextColors(kButtonTextColor); |
133 SetFontList(rb->GetFontList(kTextFontStyle)); | 131 SetFontList(rb->GetFontList(kTextFontStyle)); |
134 | 132 |
135 // Treat the space below the baseline as a margin. | 133 // Treat the space below the baseline as a margin. |
136 int verticalSpacing = kToastVerticalSpacing - | 134 int verticalSpacing = kToastVerticalSpacing - |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 288 |
291 views::Widget* ToastOverlay::widget_for_testing() { | 289 views::Widget* ToastOverlay::widget_for_testing() { |
292 return overlay_widget_.get(); | 290 return overlay_widget_.get(); |
293 } | 291 } |
294 | 292 |
295 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 293 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
296 overlay_view_->button()->NotifyClick(event); | 294 overlay_view_->button()->NotifyClick(event); |
297 } | 295 } |
298 | 296 |
299 } // namespace ash | 297 } // namespace ash |
OLD | NEW |