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/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
9 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
10 #include "ash/common/wm_root_window_controller.h" | 10 #include "ash/common/wm_root_window_controller.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // These values are in DIP. | 49 // These values are in DIP. |
50 const int kToastHorizontalSpacing = 16; | 50 const int kToastHorizontalSpacing = 16; |
51 const int kToastVerticalSpacing = 16; | 51 const int kToastVerticalSpacing = 16; |
52 const int kToastMaximumWidth = 568; | 52 const int kToastMaximumWidth = 568; |
53 const int kToastMinimumWidth = 288; | 53 const int kToastMinimumWidth = 288; |
54 | 54 |
55 // Returns the work area bounds for the root window where new windows are added | 55 // Returns the work area bounds for the root window where new windows are added |
56 // (including new toasts). | 56 // (including new toasts). |
57 gfx::Rect GetUserWorkAreaBounds() { | 57 gfx::Rect GetUserWorkAreaBounds() { |
58 return WmShell::Get() | 58 return WmShelf::ForWindow(WmShell::Get()->GetRootWindowForNewWindows()) |
59 ->GetRootWindowForNewWindows() | |
60 ->GetRootWindowController() | |
61 ->GetShelf() | |
62 ->GetUserWorkAreaBounds(); | 59 ->GetUserWorkAreaBounds(); |
63 } | 60 } |
64 | 61 |
65 } // anonymous namespace | 62 } // anonymous namespace |
66 | 63 |
67 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
68 // ToastOverlayLabel | 65 // ToastOverlayLabel |
69 class ToastOverlayLabel : public views::Label { | 66 class ToastOverlayLabel : public views::Label { |
70 public: | 67 public: |
71 explicit ToastOverlayLabel(const base::string16& label); | 68 explicit ToastOverlayLabel(const base::string16& label); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 293 |
297 views::Widget* ToastOverlay::widget_for_testing() { | 294 views::Widget* ToastOverlay::widget_for_testing() { |
298 return overlay_widget_.get(); | 295 return overlay_widget_.get(); |
299 } | 296 } |
300 | 297 |
301 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 298 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
302 overlay_view_->button()->NotifyClick(event); | 299 overlay_view_->button()->NotifyClick(event); |
303 } | 300 } |
304 | 301 |
305 } // namespace ash | 302 } // namespace ash |
OLD | NEW |