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 UI_MESSAGE_CENTER_VIEWS_POPUP_ALIGNMENT_DELEGATE_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_POPUP_ALIGNMENT_DELEGATE_H_ 7 8 #include "ui/message_center/message_center_export.h" 9 10 namespace gfx { 11 class Display; 12 class Point; 13 class Rect; 14 } 15 16 namespace message_center { 17 18 class MessagePopupCollection; 19 20 class MESSAGE_CENTER_EXPORT PopupAlignmentDelegate { 21 public: 22 PopupAlignmentDelegate(); 23 set_collection(MessagePopupCollection * collection)24 void set_collection(MessagePopupCollection* collection) { 25 collection_ = collection; 26 } 27 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; 30 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; 34 35 // Returns the height of the bottom of the current work area. 36 virtual int GetWorkAreaBottom() const = 0; 37 38 // Returns true if the toast should be aligned top down. 39 virtual bool IsTopDown() const = 0; 40 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; 44 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; 49 50 protected: 51 virtual ~PopupAlignmentDelegate(); 52 53 void DoUpdateIfPossible(); 54 55 private: 56 MessagePopupCollection* collection_; 57 }; 58 59 } // namespace message_center 60 61 #endif // UI_MESSAGE_CENTER_VIEWS_POPUP_ALIGNMENT_DELEGATE_H_ 62