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/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
9 #include "ash/common/wm_root_window_controller.h" | 9 #include "ash/common/wm_root_window_controller.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ? l10n_util::GetStringUTF16(IDS_ASH_TOAST_DISMISS_BUTTON) | 166 ? l10n_util::GetStringUTF16(IDS_ASH_TOAST_DISMISS_BUTTON) |
167 : base::UTF8ToUTF16(dismiss_text))) { | 167 : base::UTF8ToUTF16(dismiss_text))) { |
168 ToastOverlayLabel* label = new ToastOverlayLabel(text); | 168 ToastOverlayLabel* label = new ToastOverlayLabel(text); |
169 label->SetMaximumWidth( | 169 label->SetMaximumWidth( |
170 GetMaximumSize().width() - button_->GetPreferredSize().width() - | 170 GetMaximumSize().width() - button_->GetPreferredSize().width() - |
171 kToastHorizontalSpacing * 2 - kToastHorizontalSpacing * 2); | 171 kToastHorizontalSpacing * 2 - kToastHorizontalSpacing * 2); |
172 AddChildView(label); | 172 AddChildView(label); |
173 | 173 |
174 AddChildView(button_); | 174 AddChildView(button_); |
175 | 175 |
176 auto layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 176 auto* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
177 SetLayoutManager(layout); | 177 SetLayoutManager(layout); |
178 layout->SetFlexForView(label, 1); | 178 layout->SetFlexForView(label, 1); |
179 layout->SetFlexForView(button_, 0); | 179 layout->SetFlexForView(button_, 0); |
180 } | 180 } |
181 | 181 |
182 ToastOverlayView::~ToastOverlayView() {} | 182 ToastOverlayView::~ToastOverlayView() {} |
183 | 183 |
184 void ToastOverlayView::OnPaint(gfx::Canvas* canvas) { | 184 void ToastOverlayView::OnPaint(gfx::Canvas* canvas) { |
185 SkPaint paint; | 185 SkPaint paint; |
186 paint.setStyle(SkPaint::kFill_Style); | 186 paint.setStyle(SkPaint::kFill_Style); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 views::Widget* ToastOverlay::widget_for_testing() { | 288 views::Widget* ToastOverlay::widget_for_testing() { |
289 return overlay_widget_.get(); | 289 return overlay_widget_.get(); |
290 } | 290 } |
291 | 291 |
292 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 292 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
293 overlay_view_->button()->NotifyClick(event); | 293 overlay_view_->button()->NotifyClick(event); |
294 } | 294 } |
295 | 295 |
296 } // namespace ash | 296 } // namespace ash |
OLD | NEW |