| 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/common/system/toast/toast_overlay.h" | 5 #include "ash/common/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/wm_lookup.h" | 8 #include "ash/common/wm_lookup.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 label->SetMaximumWidth( | 177 label->SetMaximumWidth( |
| 178 GetMaximumSize().width() - button_->GetPreferredSize().width() - | 178 GetMaximumSize().width() - button_->GetPreferredSize().width() - |
| 179 kToastHorizontalSpacing * 2 - kToastHorizontalSpacing * 2); | 179 kToastHorizontalSpacing * 2 - kToastHorizontalSpacing * 2); |
| 180 AddChildView(button_); | 180 AddChildView(button_); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 ToastOverlayView::~ToastOverlayView() {} | 184 ToastOverlayView::~ToastOverlayView() {} |
| 185 | 185 |
| 186 void ToastOverlayView::OnPaint(gfx::Canvas* canvas) { | 186 void ToastOverlayView::OnPaint(gfx::Canvas* canvas) { |
| 187 cc::PaintFlags paint; | 187 cc::PaintFlags flags; |
| 188 paint.setStyle(cc::PaintFlags::kFill_Style); | 188 flags.setStyle(cc::PaintFlags::kFill_Style); |
| 189 paint.setColor(kButtonBackgroundColor); | 189 flags.setColor(kButtonBackgroundColor); |
| 190 canvas->DrawRoundRect(GetLocalBounds(), 2, paint); | 190 canvas->DrawRoundRect(GetLocalBounds(), 2, flags); |
| 191 views::View::OnPaint(canvas); | 191 views::View::OnPaint(canvas); |
| 192 } | 192 } |
| 193 | 193 |
| 194 gfx::Size ToastOverlayView::GetMinimumSize() const { | 194 gfx::Size ToastOverlayView::GetMinimumSize() const { |
| 195 return gfx::Size(kToastMinimumWidth, 0); | 195 return gfx::Size(kToastMinimumWidth, 0); |
| 196 } | 196 } |
| 197 | 197 |
| 198 gfx::Size ToastOverlayView::GetMaximumSize() const { | 198 gfx::Size ToastOverlayView::GetMaximumSize() const { |
| 199 gfx::Rect work_area_bounds = GetUserWorkAreaBounds(); | 199 gfx::Rect work_area_bounds = GetUserWorkAreaBounds(); |
| 200 return gfx::Size(kToastMaximumWidth, work_area_bounds.height() - kOffset * 2); | 200 return gfx::Size(kToastMaximumWidth, work_area_bounds.height() - kOffset * 2); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() { | 303 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() { |
| 304 return overlay_view_->button(); | 304 return overlay_view_->button(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 307 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
| 308 DCHECK(overlay_view_->button()); | 308 DCHECK(overlay_view_->button()); |
| 309 overlay_view_->button()->NotifyClick(event); | 309 overlay_view_->button()->NotifyClick(event); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace ash | 312 } // namespace ash |
| OLD | NEW |