Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / message_center / views / popup_alignment_delegate.h
blob5a106047d344bef7ada3a0d98d56ca1da43326d5
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_POPUP_ALIGNMENT_DELEGATE_H_
6 #define UI_MESSAGE_CENTER_VIEWS_POPUP_ALIGNMENT_DELEGATE_H_
8 #include "ui/message_center/message_center_export.h"
10 namespace gfx {
11 class Display;
12 class Point;
13 class Rect;
16 namespace message_center {
18 class MessagePopupCollection;
20 class MESSAGE_CENTER_EXPORT PopupAlignmentDelegate {
21 public:
22 PopupAlignmentDelegate();
24 void set_collection(MessagePopupCollection* collection) {
25 collection_ = collection;
28 // Returns the x-origin for the given toast bounds in the current work area.
29 virtual int GetToastOriginX(const gfx::Rect& toast_bounds) const = 0;
31 // Returns the baseline height of the current work area. That is the starting
32 // point if there are no other toasts.
33 virtual int GetBaseLine() const = 0;
35 // Returns the height of the bottom of the current work area.
36 virtual int GetWorkAreaBottom() const = 0;
38 // Returns true if the toast should be aligned top down.
39 virtual bool IsTopDown() const = 0;
41 // Returns true if the toasts are positioned at the left side of the desktop
42 // so that their reveal animation should happen from left side.
43 virtual bool IsFromLeft() const = 0;
45 // Called when a new toast appears or toasts are rearranged in the |display|.
46 // The subclass may override this method to check the current desktop status
47 // so that the toasts are arranged at the correct place.
48 virtual void RecomputeAlignment(const gfx::Display& display) = 0;
50 protected:
51 virtual ~PopupAlignmentDelegate();
53 void DoUpdateIfPossible();
55 private:
56 MessagePopupCollection* collection_;
59 } // namespace message_center
61 #endif // UI_MESSAGE_CENTER_VIEWS_POPUP_ALIGNMENT_DELEGATE_H_