| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ |
| 6 #define ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ | 6 #define ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_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/display/window_tree_host_manager.h" | 11 #include "ash/display/window_tree_host_manager.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "ui/gfx/display_observer.h" | 16 #include "ui/display/display_observer.h" |
| 17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 FORWARD_DECLARE_TEST(DisplayPreferencesTest, PreventStore); | 20 FORWARD_DECLARE_TEST(DisplayPreferencesTest, PreventStore); |
| 21 } // namespace chromeos | 21 } // namespace chromeos |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 class Label; | 24 class Label; |
| 25 class Widget; | 25 class Widget; |
| 26 } // namespace views | 26 } // namespace views |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 struct DisplayMode; | 30 struct DisplayMode; |
| 31 | 31 |
| 32 // A class which manages the notification of display resolution change and | 32 // A class which manages the notification of display resolution change and |
| 33 // also manages the timeout in case the new resolution is unusable. | 33 // also manages the timeout in case the new resolution is unusable. |
| 34 class ASH_EXPORT ResolutionNotificationController | 34 class ASH_EXPORT ResolutionNotificationController |
| 35 : public gfx::DisplayObserver, | 35 : public display::DisplayObserver, |
| 36 public WindowTreeHostManager::Observer { | 36 public WindowTreeHostManager::Observer { |
| 37 public: | 37 public: |
| 38 ResolutionNotificationController(); | 38 ResolutionNotificationController(); |
| 39 ~ResolutionNotificationController() override; | 39 ~ResolutionNotificationController() override; |
| 40 | 40 |
| 41 // Prepare a resolution change notification for |display_id| from | 41 // Prepare a resolution change notification for |display_id| from |
| 42 // |old_resolution| to |new_resolution|, which offers a button to revert the | 42 // |old_resolution| to |new_resolution|, which offers a button to revert the |
| 43 // change in case something goes wrong. The notification times out if there's | 43 // change in case something goes wrong. The notification times out if there's |
| 44 // only one display connected and the user is trying to modify its resolution. | 44 // only one display connected and the user is trying to modify its resolution. |
| 45 // In that case, the timeout has to be set since the user cannot make any | 45 // In that case, the timeout has to be set since the user cannot make any |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Create a new notification, or update its content if it already exists. | 82 // Create a new notification, or update its content if it already exists. |
| 83 // |enable_spoken_feedback| is set to false when the notification is updated | 83 // |enable_spoken_feedback| is set to false when the notification is updated |
| 84 // during the countdown so the update isn't necessarily read by the spoken | 84 // during the countdown so the update isn't necessarily read by the spoken |
| 85 // feedback. | 85 // feedback. |
| 86 void CreateOrUpdateNotification(bool enable_spoken_feedback); | 86 void CreateOrUpdateNotification(bool enable_spoken_feedback); |
| 87 | 87 |
| 88 // Called every second for timeout. | 88 // Called every second for timeout. |
| 89 void OnTimerTick(); | 89 void OnTimerTick(); |
| 90 | 90 |
| 91 // gfx::DisplayObserver overrides: | 91 // display::DisplayObserver overrides: |
| 92 void OnDisplayAdded(const gfx::Display& new_display) override; | 92 void OnDisplayAdded(const display::Display& new_display) override; |
| 93 void OnDisplayRemoved(const gfx::Display& old_display) override; | 93 void OnDisplayRemoved(const display::Display& old_display) override; |
| 94 void OnDisplayMetricsChanged(const gfx::Display& display, | 94 void OnDisplayMetricsChanged(const display::Display& display, |
| 95 uint32_t metrics) override; | 95 uint32_t metrics) override; |
| 96 | 96 |
| 97 // WindowTreeHostManager::Observer overrides: | 97 // WindowTreeHostManager::Observer overrides: |
| 98 void OnDisplayConfigurationChanged() override; | 98 void OnDisplayConfigurationChanged() override; |
| 99 | 99 |
| 100 static void SuppressTimerForTest(); | 100 static void SuppressTimerForTest(); |
| 101 | 101 |
| 102 std::unique_ptr<ResolutionChangeInfo> change_info_; | 102 std::unique_ptr<ResolutionChangeInfo> change_info_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(ResolutionNotificationController); | 104 DISALLOW_COPY_AND_ASSIGN(ResolutionNotificationController); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace ash | 107 } // namespace ash |
| 108 | 108 |
| 109 #endif // ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ | 109 #endif // ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ |
| OLD | NEW |