Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 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 | |
| 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 from top to down. | |
|
stevenjb
2014/07/02 21:59:24
s/from top to down/top down/ (or 'from top to bott
Jun Mukai
2014/07/07 18:12:36
Done.
| |
| 39 virtual bool IsTopDown() const = 0; | |
| 40 | |
| 41 // Returns true if the toasts is positioned at the left side of the desktop | |
|
stevenjb
2014/07/02 21:59:24
s/toasts is/toasts are/
Jun Mukai
2014/07/07 18:12:36
Done.
| |
| 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 right place. | |
|
stevenjb
2014/07/02 21:59:24
s/right/correct/ (only because 'right' is ambiguou
Jun Mukai
2014/07/07 18:12:36
Done.
| |
| 48 virtual void RecomputeAlignment(const gfx::Display& display) {} | |
|
stevenjb
2014/07/02 21:59:23
nit: It might be better to make this a pure virtua
Jun Mukai
2014/07/07 18:12:36
Done.
| |
| 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_ | |
| OLD | NEW |