Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/display_observer.h" | 11 #include "ui/display/display_observer.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/message_center/views/popup_alignment_delegate.h" | 13 #include "ui/message_center/views/popup_alignment_delegate.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Screen; | 16 class Screen; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace display { | |
| 20 using Screen = gfx::Screen; | |
| 21 } | |
|
oshima
2016/04/26 06:04:50
This is temporary and will be consolidated to
nam
| |
| 22 | |
| 19 namespace message_center { | 23 namespace message_center { |
| 20 namespace test { | 24 namespace test { |
| 21 class MessagePopupCollectionTest; | 25 class MessagePopupCollectionTest; |
| 22 } | 26 } |
| 23 | 27 |
| 24 // The PopupAlignmentDelegate for non-ash Windows/Linux desktop. | 28 // The PopupAlignmentDelegate for non-ash Windows/Linux desktop. |
| 25 class MESSAGE_CENTER_EXPORT DesktopPopupAlignmentDelegate | 29 class MESSAGE_CENTER_EXPORT DesktopPopupAlignmentDelegate |
| 26 : public PopupAlignmentDelegate, | 30 : public PopupAlignmentDelegate, |
| 27 public gfx::DisplayObserver { | 31 public display::DisplayObserver { |
| 28 public: | 32 public: |
| 29 DesktopPopupAlignmentDelegate(); | 33 DesktopPopupAlignmentDelegate(); |
| 30 ~DesktopPopupAlignmentDelegate() override; | 34 ~DesktopPopupAlignmentDelegate() override; |
| 31 | 35 |
| 32 void StartObserving(gfx::Screen* screen); | 36 void StartObserving(display::Screen* screen); |
| 33 | 37 |
| 34 // Overridden from PopupAlignmentDelegate: | 38 // Overridden from PopupAlignmentDelegate: |
| 35 int GetToastOriginX(const gfx::Rect& toast_bounds) const override; | 39 int GetToastOriginX(const gfx::Rect& toast_bounds) const override; |
| 36 int GetBaseLine() const override; | 40 int GetBaseLine() const override; |
| 37 int GetWorkAreaBottom() const override; | 41 int GetWorkAreaBottom() const override; |
| 38 bool IsTopDown() const override; | 42 bool IsTopDown() const override; |
| 39 bool IsFromLeft() const override; | 43 bool IsFromLeft() const override; |
| 40 void RecomputeAlignment(const gfx::Display& display) override; | 44 void RecomputeAlignment(const display::Display& display) override; |
| 41 | 45 |
| 42 private: | 46 private: |
| 43 friend class test::MessagePopupCollectionTest; | 47 friend class test::MessagePopupCollectionTest; |
| 44 | 48 |
| 45 enum PopupAlignment { | 49 enum PopupAlignment { |
| 46 POPUP_ALIGNMENT_TOP = 1 << 0, | 50 POPUP_ALIGNMENT_TOP = 1 << 0, |
| 47 POPUP_ALIGNMENT_LEFT = 1 << 1, | 51 POPUP_ALIGNMENT_LEFT = 1 << 1, |
| 48 POPUP_ALIGNMENT_BOTTOM = 1 << 2, | 52 POPUP_ALIGNMENT_BOTTOM = 1 << 2, |
| 49 POPUP_ALIGNMENT_RIGHT = 1 << 3, | 53 POPUP_ALIGNMENT_RIGHT = 1 << 3, |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 // Overridden from gfx::DisplayObserver: | 56 // Overridden from display::DisplayObserver: |
| 53 void OnDisplayAdded(const gfx::Display& new_display) override; | 57 void OnDisplayAdded(const display::Display& new_display) override; |
| 54 void OnDisplayRemoved(const gfx::Display& old_display) override; | 58 void OnDisplayRemoved(const display::Display& old_display) override; |
| 55 void OnDisplayMetricsChanged(const gfx::Display& display, | 59 void OnDisplayMetricsChanged(const display::Display& display, |
| 56 uint32_t metrics) override; | 60 uint32_t metrics) override; |
| 57 | 61 |
| 58 int32_t alignment_; | 62 int32_t alignment_; |
| 59 int64_t display_id_; | 63 int64_t display_id_; |
| 60 gfx::Screen* screen_; | 64 display::Screen* screen_; |
| 61 gfx::Rect work_area_; | 65 gfx::Rect work_area_; |
| 62 | 66 |
| 63 DISALLOW_COPY_AND_ASSIGN(DesktopPopupAlignmentDelegate); | 67 DISALLOW_COPY_AND_ASSIGN(DesktopPopupAlignmentDelegate); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace message_center | 70 } // namespace message_center |
| 67 | 71 |
| 68 #endif // UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ | 72 #endif // UI_MESSAGE_CENTER_VIEWS_DESKTOP_POPUP_ALIGNMENT_DELEGATE_H_ |
| OLD | NEW |