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.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_
6 #define UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_
8 #include "base/macros.h"
9 #include "ui/gfx/display_observer.h"
10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/message_center/views/popup_alignment_delegate.h"
17 namespace message_center
{
19 class MessagePopupCollectionTest
;
22 // The PopupAlignmentDelegate for non-ash Windows/Linux desktop.
23 class MESSAGE_CENTER_EXPORT DesktopPopupAlignmentDelegate
24 : public PopupAlignmentDelegate
,
25 public gfx::DisplayObserver
{
27 DesktopPopupAlignmentDelegate();
28 ~DesktopPopupAlignmentDelegate() override
;
30 void StartObserving(gfx::Screen
* screen
);
32 // Overridden from PopupAlignmentDelegate:
33 int GetToastOriginX(const gfx::Rect
& toast_bounds
) const override
;
34 int GetBaseLine() const override
;
35 int GetWorkAreaBottom() const override
;
36 bool IsTopDown() const override
;
37 bool IsFromLeft() const override
;
38 void RecomputeAlignment(const gfx::Display
& display
) override
;
41 friend class test::MessagePopupCollectionTest
;
44 POPUP_ALIGNMENT_TOP
= 1 << 0,
45 POPUP_ALIGNMENT_LEFT
= 1 << 1,
46 POPUP_ALIGNMENT_BOTTOM
= 1 << 2,
47 POPUP_ALIGNMENT_RIGHT
= 1 << 3,
50 // Overridden from gfx::DisplayObserver:
51 void OnDisplayAdded(const gfx::Display
& new_display
) override
;
52 void OnDisplayRemoved(const gfx::Display
& old_display
) override
;
53 void OnDisplayMetricsChanged(const gfx::Display
& display
,
54 uint32_t metrics
) override
;
61 DISALLOW_COPY_AND_ASSIGN(DesktopPopupAlignmentDelegate
);
64 } // namespace message_center
66 #endif // UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_