OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 6 #define ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/shelf/shelf_types.h" | 11 #include "ash/common/shelf/shelf_types.h" |
| 12 #include "ash/common/shelf/wm_shelf_observer.h" |
12 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
13 #include "ash/shelf/shelf_layout_manager_observer.h" | |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ui/display/display_observer.h" | 15 #include "ui/display/display_observer.h" |
16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
17 #include "ui/message_center/views/popup_alignment_delegate.h" | 17 #include "ui/message_center/views/popup_alignment_delegate.h" |
18 | 18 |
19 namespace display { | 19 namespace display { |
20 class Screen; | 20 class Screen; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 | 24 |
25 class AshPopupAlignmentDelegateTest; | 25 class AshPopupAlignmentDelegateTest; |
26 class ShelfLayoutManager; | 26 class ShelfLayoutManager; |
27 class WebNotificationTrayTest; | 27 class WebNotificationTrayTest; |
| 28 class WmShelf; |
28 | 29 |
29 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of | 30 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of |
30 // the shelf and its autohide state. | 31 // the shelf and its autohide state. |
31 class ASH_EXPORT AshPopupAlignmentDelegate | 32 class ASH_EXPORT AshPopupAlignmentDelegate |
32 : public message_center::PopupAlignmentDelegate, | 33 : public message_center::PopupAlignmentDelegate, |
33 public ShelfLayoutManagerObserver, | 34 public WmShelfObserver, |
34 public ShellObserver, | 35 public ShellObserver, |
35 public display::DisplayObserver { | 36 public display::DisplayObserver { |
36 public: | 37 public: |
37 explicit AshPopupAlignmentDelegate(ShelfLayoutManager* shelf); | 38 explicit AshPopupAlignmentDelegate(WmShelf* shelf); |
38 ~AshPopupAlignmentDelegate() override; | 39 ~AshPopupAlignmentDelegate() override; |
39 | 40 |
40 // Start observing the system. | 41 // Start observing the system. |
41 void StartObserving(display::Screen* screen, const display::Display& display); | 42 void StartObserving(display::Screen* screen, const display::Display& display); |
42 | 43 |
43 // Sets the current height of the system tray so that the notification toasts | 44 // Sets the current height of the system tray so that the notification toasts |
44 // can avoid it. | 45 // can avoid it. |
45 void SetSystemTrayHeight(int height); | 46 void SetSystemTrayHeight(int height); |
46 | 47 |
47 // Returns the current system tray height. | 48 // Returns the current system tray height. |
(...skipping 16 matching lines...) Expand all Loading... |
64 | 65 |
65 // Utility function to get the display which should be care about. | 66 // Utility function to get the display which should be care about. |
66 display::Display GetCurrentDisplay() const; | 67 display::Display GetCurrentDisplay() const; |
67 | 68 |
68 // Compute the new work area. | 69 // Compute the new work area. |
69 void UpdateWorkArea(); | 70 void UpdateWorkArea(); |
70 | 71 |
71 // Overridden from ShellObserver: | 72 // Overridden from ShellObserver: |
72 void OnDisplayWorkAreaInsetsChanged() override; | 73 void OnDisplayWorkAreaInsetsChanged() override; |
73 | 74 |
74 // Overridden from ShelfLayoutManagerObserver: | 75 // WmShelfObserver: |
75 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 76 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
76 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | 77 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
77 | 78 |
78 // Overridden from display::DisplayObserver: | 79 // Overridden from display::DisplayObserver: |
79 void OnDisplayAdded(const display::Display& new_display) override; | 80 void OnDisplayAdded(const display::Display& new_display) override; |
80 void OnDisplayRemoved(const display::Display& old_display) override; | 81 void OnDisplayRemoved(const display::Display& old_display) override; |
81 void OnDisplayMetricsChanged(const display::Display& display, | 82 void OnDisplayMetricsChanged(const display::Display& display, |
82 uint32_t metrics) override; | 83 uint32_t metrics) override; |
83 | 84 |
84 display::Screen* screen_; | 85 display::Screen* screen_; |
85 gfx::Rect work_area_; | 86 gfx::Rect work_area_; |
86 ShelfLayoutManager* shelf_; | 87 WmShelf* shelf_; |
87 int system_tray_height_; | 88 int system_tray_height_; |
88 | 89 |
89 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate); | 90 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate); |
90 }; | 91 }; |
91 | 92 |
92 } // namespace ash | 93 } // namespace ash |
93 | 94 |
94 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 95 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
OLD | NEW |