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

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

Issue 2103603002: mash: Remove StatusAreaWidget references from system tray classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments, rename SetSystemTrayHeight to SetTrayBubbleHeight Created 4 years, 5 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
(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_ASH_POPUP_ALIGNMENT_DELEGATE_H_
6 #define ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_
7
8 #include <stdint.h>
9
10 #include "ash/ash_export.h"
11 #include "ash/common/shelf/shelf_types.h"
12 #include "ash/common/shelf/wm_shelf_observer.h"
13 #include "ash/common/shell_observer.h"
14 #include "base/macros.h"
15 #include "ui/display/display_observer.h"
16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/message_center/views/popup_alignment_delegate.h"
18
19 namespace display {
20 class Screen;
21 }
22
23 namespace ash {
24
25 class AshPopupAlignmentDelegateTest;
26 class ShelfLayoutManager;
27 class WebNotificationTrayTest;
28 class WmShelf;
29
30 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of
31 // the shelf and its autohide state.
32 class ASH_EXPORT AshPopupAlignmentDelegate
33 : public message_center::PopupAlignmentDelegate,
34 public WmShelfObserver,
35 public ShellObserver,
36 public display::DisplayObserver {
37 public:
38 explicit AshPopupAlignmentDelegate(WmShelf* shelf);
39 ~AshPopupAlignmentDelegate() override;
40
41 // Start observing the system.
42 void StartObserving(display::Screen* screen, const display::Display& display);
43
44 // Sets the current height of the system tray so that the notification toasts
45 // can avoid it.
46 void SetSystemTrayHeight(int height);
47
48 // Returns the current system tray height.
49 int system_tray_height_for_test() const { return system_tray_height_; }
50
51 // Overridden from message_center::PopupAlignmentDelegate:
52 int GetToastOriginX(const gfx::Rect& toast_bounds) const override;
53 int GetBaseLine() const override;
54 int GetWorkAreaBottom() const override;
55 bool IsTopDown() const override;
56 bool IsFromLeft() const override;
57 void RecomputeAlignment(const display::Display& display) override;
58 void ConfigureWidgetInitParamsForContainer(
59 views::Widget* widget,
60 views::Widget::InitParams* init_params) override;
61
62 private:
63 friend class AshPopupAlignmentDelegateTest;
64 friend class WebNotificationTrayTest;
65
66 // Get the current alignment of the shelf.
67 ShelfAlignment GetAlignment() const;
68
69 // Utility function to get the display which should be care about.
70 display::Display GetCurrentDisplay() const;
71
72 // Compute the new work area.
73 void UpdateWorkArea();
74
75 // Overridden from ShellObserver:
76 void OnDisplayWorkAreaInsetsChanged() override;
77
78 // WmShelfObserver:
79 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
80 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
81
82 // Overridden from display::DisplayObserver:
83 void OnDisplayAdded(const display::Display& new_display) override;
84 void OnDisplayRemoved(const display::Display& old_display) override;
85 void OnDisplayMetricsChanged(const display::Display& display,
86 uint32_t metrics) override;
87
88 display::Screen* screen_;
89 gfx::Rect work_area_;
90 WmShelf* shelf_;
91 int system_tray_height_;
92
93 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate);
94 };
95
96 } // namespace ash
97
98 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_unittest.cc ('k') | ash/system/web_notification/ash_popup_alignment_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698