| 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 ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
| 6 #define ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 6 #define ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" |
| 12 #include "ash/shelf/wm_shelf_observer.h" | 12 #include "ash/shelf/shelf_observer.h" |
| 13 #include "ash/shell_observer.h" | 13 #include "ash/shell_observer.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/display/display_observer.h" | 15 #include "ui/display/display_observer.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/message_center/views/popup_alignment_delegate.h" | 17 #include "ui/message_center/views/popup_alignment_delegate.h" |
| 18 | 18 |
| 19 namespace display { | 19 namespace display { |
| 20 class Screen; | 20 class Screen; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| 25 class AshPopupAlignmentDelegateTest; | 25 class AshPopupAlignmentDelegateTest; |
| 26 class Shelf; |
| 26 class WebNotificationTrayTest; | 27 class WebNotificationTrayTest; |
| 27 class WmShelf; | |
| 28 | 28 |
| 29 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of | 29 // The PopupAlignmentDelegate subclass for Ash. It needs to handle alignment of |
| 30 // the shelf and its autohide state. | 30 // the shelf and its autohide state. |
| 31 class ASH_EXPORT AshPopupAlignmentDelegate | 31 class ASH_EXPORT AshPopupAlignmentDelegate |
| 32 : public message_center::PopupAlignmentDelegate, | 32 : public message_center::PopupAlignmentDelegate, |
| 33 public WmShelfObserver, | 33 public ShelfObserver, |
| 34 public ShellObserver, | 34 public ShellObserver, |
| 35 public display::DisplayObserver { | 35 public display::DisplayObserver { |
| 36 public: | 36 public: |
| 37 explicit AshPopupAlignmentDelegate(WmShelf* shelf); | 37 explicit AshPopupAlignmentDelegate(Shelf* shelf); |
| 38 ~AshPopupAlignmentDelegate() override; | 38 ~AshPopupAlignmentDelegate() override; |
| 39 | 39 |
| 40 // Start observing the system. | 40 // Start observing the system. |
| 41 void StartObserving(display::Screen* screen, const display::Display& display); | 41 void StartObserving(display::Screen* screen, const display::Display& display); |
| 42 | 42 |
| 43 // Sets the current height of the system tray bubble (or legacy notification | 43 // Sets the current height of the system tray bubble (or legacy notification |
| 44 // bubble) so that web notification toasts can avoid it. | 44 // bubble) so that web notification toasts can avoid it. |
| 45 void SetTrayBubbleHeight(int height); | 45 void SetTrayBubbleHeight(int height); |
| 46 | 46 |
| 47 // Returns the current tray bubble height or 0 if there is no bubble. | 47 // Returns the current tray bubble height or 0 if there is no bubble. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 // Get the current alignment of the shelf. | 66 // Get the current alignment of the shelf. |
| 67 ShelfAlignment GetAlignment() const; | 67 ShelfAlignment GetAlignment() const; |
| 68 | 68 |
| 69 // Utility function to get the display which should be care about. | 69 // Utility function to get the display which should be care about. |
| 70 display::Display GetCurrentDisplay() const; | 70 display::Display GetCurrentDisplay() const; |
| 71 | 71 |
| 72 // Compute the new work area. | 72 // Compute the new work area. |
| 73 void UpdateWorkArea(); | 73 void UpdateWorkArea(); |
| 74 | 74 |
| 75 // WmShelfObserver: | 75 // ShelfObserver: |
| 76 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 76 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
| 77 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | 77 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
| 78 | 78 |
| 79 // Overridden from display::DisplayObserver: | 79 // Overridden from display::DisplayObserver: |
| 80 void OnDisplayAdded(const display::Display& new_display) override; | 80 void OnDisplayAdded(const display::Display& new_display) override; |
| 81 void OnDisplayRemoved(const display::Display& old_display) override; | 81 void OnDisplayRemoved(const display::Display& old_display) override; |
| 82 void OnDisplayMetricsChanged(const display::Display& display, | 82 void OnDisplayMetricsChanged(const display::Display& display, |
| 83 uint32_t metrics) override; | 83 uint32_t metrics) override; |
| 84 | 84 |
| 85 display::Screen* screen_; | 85 display::Screen* screen_; |
| 86 gfx::Rect work_area_; | 86 gfx::Rect work_area_; |
| 87 WmShelf* shelf_; | 87 Shelf* shelf_; |
| 88 int tray_bubble_height_; | 88 int tray_bubble_height_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate); | 90 DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegate); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace ash | 93 } // namespace ash |
| 94 | 94 |
| 95 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ | 95 #endif // ASH_SYSTEM_WEB_NOTIFICATION_ASH_POPUP_ALIGNMENT_DELEGATE_H_ |
| OLD | NEW |