OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_POPUP_ALIGNMENT_DELEGATE_H_ | |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_POPUP_ALIGNMENT_DELEGATE_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/shelf/shelf_layout_manager_observer.h" | |
10 #include "ash/shelf/shelf_types.h" | |
11 #include "ash/shell_observer.h" | |
12 #include "base/macros.h" | |
13 #include "ui/gfx/display_observer.h" | |
14 #include "ui/gfx/geometry/rect.h" | |
15 #include "ui/message_center/views/popup_alignment_delegate.h" | |
16 | |
17 namespace aura { | |
18 class Window; | |
19 } | |
20 | |
21 namespace gfx { | |
22 class Screen; | |
23 } | |
24 | |
25 namespace ash { | |
26 | |
27 class PopupAlignmentDelegateTest; | |
28 class ShelfLayoutManager; | |
29 class WebNotificationTrayTest; | |
30 | |
31 // The PopupAlignmentDelegate for Ash. It needs to care of alignment of the | |
stevenjb
2014/07/02 21:59:23
s/care of/handle/ (or 'take care of')
Jun Mukai
2014/07/07 18:12:35
Done.
| |
32 // shelf and its autohide state. | |
33 class ASH_EXPORT PopupAlignmentDelegate | |
stevenjb
2014/07/02 21:59:23
Can we name this AshPopupAlignmentDelegate just to
Jun Mukai
2014/07/07 18:12:36
Done.
| |
34 : public message_center::PopupAlignmentDelegate, | |
35 public ShelfLayoutManagerObserver, | |
36 public ShellObserver, | |
37 public gfx::DisplayObserver { | |
38 public: | |
39 PopupAlignmentDelegate(); | |
40 virtual ~PopupAlignmentDelegate(); | |
41 | |
42 // Start observing the system. | |
43 void StartObserving(gfx::Screen* screen, const gfx::Display& display); | |
44 | |
45 // Sets the current height of the system tray so that the notification toasts | |
46 // can avoid it. | |
47 void SetSystemTrayHeight(int height); | |
48 | |
49 // Overridden from message_center::PopupAlignmentDelegate: | |
50 virtual int GetToastOriginX(const gfx::Rect& toast_bounds) const OVERRIDE; | |
51 virtual int GetBaseLine() const OVERRIDE; | |
52 virtual int GetWorkAreaBottom() const OVERRIDE; | |
53 virtual bool IsTopDown() const OVERRIDE; | |
54 virtual bool IsFromLeft() const OVERRIDE; | |
55 | |
56 private: | |
57 friend class PopupAlignmentDelegateTest; | |
58 friend class WebNotificationTrayTest; | |
59 | |
60 // Get the current alignment of the shelf. | |
61 ShelfAlignment GetAlignment() const; | |
62 | |
63 // Update |shelf_| and start watching when it's set first. This should not | |
stevenjb
2014/07/02 21:59:23
s/set first/first set/
Jun Mukai
2014/07/07 18:12:36
Done.
| |
64 // be done in the constructor because shelf might not be initialized at that | |
stevenjb
2014/07/02 21:59:23
s/shelf/the shelf/
Jun Mukai
2014/07/07 18:12:35
Done.
| |
65 // point. | |
66 void UpdateShelf(); | |
67 | |
68 // Overridden from ShellObserver: | |
69 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; | |
70 | |
71 // Overridden from ShelfLayoutManagerObserver: | |
72 virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) OVERRIDE; | |
73 | |
74 // Overridden from gfx::DisplayObserver: | |
75 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | |
76 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | |
77 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | |
78 uint32_t metrics) OVERRIDE; | |
79 | |
80 int64_t display_id_; | |
81 gfx::Screen* screen_; | |
82 gfx::Rect work_area_; | |
83 aura::Window* root_window_; | |
84 ShelfLayoutManager* shelf_; | |
85 int system_tray_height_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(PopupAlignmentDelegate); | |
88 }; | |
89 | |
90 } // namespace message_center | |
91 | |
92 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | |
OLD | NEW |