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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 struct DisplayMode; | 27 struct DisplayMode; |
28 | 28 |
29 // A class which manages the notification of display resolution change and | 29 // A class which manages the notification of display resolution change and |
30 // also manages the timeout in case the new resolution is unusable. | 30 // also manages the timeout in case the new resolution is unusable. |
31 class ASH_EXPORT ResolutionNotificationController | 31 class ASH_EXPORT ResolutionNotificationController |
32 : public gfx::DisplayObserver, | 32 : public gfx::DisplayObserver, |
33 public DisplayController::Observer { | 33 public DisplayController::Observer { |
34 public: | 34 public: |
35 ResolutionNotificationController(); | 35 ResolutionNotificationController(); |
36 virtual ~ResolutionNotificationController(); | 36 ~ResolutionNotificationController() override; |
37 | 37 |
38 // Prepare a resolution change notification for |display_id| from | 38 // Prepare a resolution change notification for |display_id| from |
39 // |old_resolution| to |new_resolution|, which offers a button to revert the | 39 // |old_resolution| to |new_resolution|, which offers a button to revert the |
40 // change in case something goes wrong. The notification times out if there's | 40 // change in case something goes wrong. The notification times out if there's |
41 // only one display connected and the user is trying to modify its resolution. | 41 // only one display connected and the user is trying to modify its resolution. |
42 // In that case, the timeout has to be set since the user cannot make any | 42 // In that case, the timeout has to be set since the user cannot make any |
43 // changes if something goes wrong. | 43 // changes if something goes wrong. |
44 // | 44 // |
45 // This method does not create a notification itself. The notification will be | 45 // This method does not create a notification itself. The notification will be |
46 // created the next OnDisplayConfigurationChanged(), which will be called | 46 // created the next OnDisplayConfigurationChanged(), which will be called |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Create a new notification, or update its content if it already exists. | 79 // Create a new notification, or update its content if it already exists. |
80 // |enable_spoken_feedback| is set to false when the notification is updated | 80 // |enable_spoken_feedback| is set to false when the notification is updated |
81 // during the countdown so the update isn't necessarily read by the spoken | 81 // during the countdown so the update isn't necessarily read by the spoken |
82 // feedback. | 82 // feedback. |
83 void CreateOrUpdateNotification(bool enable_spoken_feedback); | 83 void CreateOrUpdateNotification(bool enable_spoken_feedback); |
84 | 84 |
85 // Called every second for timeout. | 85 // Called every second for timeout. |
86 void OnTimerTick(); | 86 void OnTimerTick(); |
87 | 87 |
88 // gfx::DisplayObserver overrides: | 88 // gfx::DisplayObserver overrides: |
89 virtual void OnDisplayAdded(const gfx::Display& new_display) override; | 89 void OnDisplayAdded(const gfx::Display& new_display) override; |
90 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; | 90 void OnDisplayRemoved(const gfx::Display& old_display) override; |
91 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 91 void OnDisplayMetricsChanged(const gfx::Display& display, |
92 uint32_t metrics) override; | 92 uint32_t metrics) override; |
93 | 93 |
94 // DisplayController::Observer overrides: | 94 // DisplayController::Observer overrides: |
95 virtual void OnDisplayConfigurationChanged() override; | 95 void OnDisplayConfigurationChanged() override; |
96 | 96 |
97 static void SuppressTimerForTest(); | 97 static void SuppressTimerForTest(); |
98 | 98 |
99 scoped_ptr<ResolutionChangeInfo> change_info_; | 99 scoped_ptr<ResolutionChangeInfo> change_info_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(ResolutionNotificationController); | 101 DISALLOW_COPY_AND_ASSIGN(ResolutionNotificationController); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace ash | 104 } // namespace ash |
105 | 105 |
106 #endif // ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ | 106 #endif // ASH_DISPLAY_RESOLUTION_NOTIFICATION_CONTROLLER_H_ |
OLD | NEW |