Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: ash/system/web_notification/ash_popup_alignment_delegate.h

Issue 1659283002: ash: Explicitly teach various components about ShelfLayoutManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-ui-event-platform-event
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 20 matching lines...) Expand all
31 class WebNotificationTrayTest; 31 class WebNotificationTrayTest;
32 32
33 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of 33 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of
34 // the shelf and its autohide state. 34 // the shelf and its autohide state.
35 class ASH_EXPORT AshPopupAlignmentDelegate 35 class ASH_EXPORT AshPopupAlignmentDelegate
36 : public message_center::PopupAlignmentDelegate, 36 : public message_center::PopupAlignmentDelegate,
37 public ShelfLayoutManagerObserver, 37 public ShelfLayoutManagerObserver,
38 public ShellObserver, 38 public ShellObserver,
39 public gfx::DisplayObserver { 39 public gfx::DisplayObserver {
40 public: 40 public:
41 AshPopupAlignmentDelegate(); 41 explicit AshPopupAlignmentDelegate(ShelfLayoutManager* shelf);
42 ~AshPopupAlignmentDelegate() override; 42 ~AshPopupAlignmentDelegate() override;
43 43
44 // Start observing the system. 44 // Start observing the system.
45 void StartObserving(gfx::Screen* screen, const gfx::Display& display); 45 void StartObserving(gfx::Screen* screen, const gfx::Display& display);
46 46
47 // Sets the current height of the system tray so that the notification toasts 47 // Sets the current height of the system tray so that the notification toasts
48 // can avoid it. 48 // can avoid it.
49 void SetSystemTrayHeight(int height); 49 void SetSystemTrayHeight(int height);
50 50
51 // Overridden from message_center::PopupAlignmentDelegate: 51 // Overridden from message_center::PopupAlignmentDelegate:
52 int GetToastOriginX(const gfx::Rect& toast_bounds) const override; 52 int GetToastOriginX(const gfx::Rect& toast_bounds) const override;
53 int GetBaseLine() const override; 53 int GetBaseLine() const override;
54 int GetWorkAreaBottom() const override; 54 int GetWorkAreaBottom() const override;
55 bool IsTopDown() const override; 55 bool IsTopDown() const override;
56 bool IsFromLeft() const override; 56 bool IsFromLeft() const override;
57 void RecomputeAlignment(const gfx::Display& display) override; 57 void RecomputeAlignment(const gfx::Display& display) override;
58 58
59 private: 59 private:
60 friend class AshPopupAlignmentDelegateTest; 60 friend class AshPopupAlignmentDelegateTest;
61 friend class WebNotificationTrayTest; 61 friend class WebNotificationTrayTest;
62 62
63 // Get the current alignment of the shelf. 63 // Get the current alignment of the shelf.
64 ShelfAlignment GetAlignment() const; 64 ShelfAlignment GetAlignment() const;
65 65
66 // Update |shelf_| and start watching when it's first set. This should not
67 // be done in the constructor because the shelf might not be initialized at
68 // that point.
69 void UpdateShelf();
70
71 // Utility function to get the display which should be care about. 66 // Utility function to get the display which should be care about.
72 gfx::Display GetCurrentDisplay() const; 67 gfx::Display GetCurrentDisplay() const;
73 68
74 // Compute the new work area. 69 // Compute the new work area.
75 void UpdateWorkArea(); 70 void UpdateWorkArea();
76 71
77 // Overridden from ShellObserver: 72 // Overridden from ShellObserver:
78 void OnDisplayWorkAreaInsetsChanged() override; 73 void OnDisplayWorkAreaInsetsChanged() override;
79 74
80 // Overridden from ShelfLayoutManagerObserver: 75 // Overridden from ShelfLayoutManagerObserver:
(...skipping 11 matching lines...) Expand all
92 aura::Window* root_window_; 87 aura::Window* root_window_;
93 ShelfLayoutManager* shelf_; 88 ShelfLayoutManager* shelf_;
94 int system_tray_height_; 89 int system_tray_height_;
95 90
96 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate); 91 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate);
97 }; 92 };
98 93
99 } // namespace ash 94 } // namespace ash
100 95
101 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ 96 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698