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_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ |
6 #define UI_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ | 6 #define UI_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 MultipleDisplayState /* new_display_state */, | 28 MultipleDisplayState /* new_display_state */, |
29 chromeos::DisplayPowerState /* new_power_state */)> ResponseCallback; | 29 chromeos::DisplayPowerState /* new_power_state */)> ResponseCallback; |
30 | 30 |
31 UpdateDisplayConfigurationTask(NativeDisplayDelegate* delegate, | 31 UpdateDisplayConfigurationTask(NativeDisplayDelegate* delegate, |
32 DisplayLayoutManager* layout_manager, | 32 DisplayLayoutManager* layout_manager, |
33 MultipleDisplayState new_display_state, | 33 MultipleDisplayState new_display_state, |
34 chromeos::DisplayPowerState new_power_state, | 34 chromeos::DisplayPowerState new_power_state, |
35 int power_flags, | 35 int power_flags, |
36 uint32_t background_color_argb, | 36 uint32_t background_color_argb, |
37 bool force_configure, | 37 bool force_configure, |
| 38 bool configure_cached_displays, |
38 const ResponseCallback& callback); | 39 const ResponseCallback& callback); |
39 ~UpdateDisplayConfigurationTask(); | 40 ~UpdateDisplayConfigurationTask(); |
40 | 41 |
41 // The pointers to the DisplaySnapshots in this vector are owned by | 42 // The pointers to the DisplaySnapshots in this vector are owned by |
42 // DisplayConfigurator. | 43 // DisplayConfigurator. |
43 void set_virtual_display_snapshots(std::vector<DisplaySnapshot*> snapshots) { | 44 void set_virtual_display_snapshots(std::vector<DisplaySnapshot*> snapshots) { |
44 virtual_display_snapshots_ = snapshots; | 45 virtual_display_snapshots_ = snapshots; |
45 } | 46 } |
46 | 47 |
47 void Run(); | 48 void Run(); |
48 | 49 |
49 private: | 50 private: |
| 51 void OnCachedDisplaysRetrieved(const std::vector<DisplaySnapshot*>& displays); |
50 // Callback to NativeDisplayDelegate::GetDisplays(). | 52 // Callback to NativeDisplayDelegate::GetDisplays(). |
51 void OnDisplaysUpdated(const std::vector<DisplaySnapshot*>& displays); | 53 void OnDisplaysUpdated(const std::vector<DisplaySnapshot*>& displays); |
52 | 54 |
53 // Callback to ConfigureDisplaysTask used to process the result of a display | 55 // Callback to ConfigureDisplaysTask used to process the result of a display |
54 // configuration run. | 56 // configuration run. |
55 void OnStateEntered(ConfigureDisplaysTask::Status status); | 57 void OnStateEntered(ConfigureDisplaysTask::Status status); |
56 | 58 |
57 // If the initial display configuration run failed due to errors entering | 59 // If the initial display configuration run failed due to errors entering |
58 // mirror more, another configuration run is executed to enter software | 60 // mirror more, another configuration run is executed to enter software |
59 // mirroring. This is the callback used to process the result of that | 61 // mirroring. This is the callback used to process the result of that |
(...skipping 26 matching lines...) Expand all Loading... |
86 chromeos::DisplayPowerState new_power_state_; | 88 chromeos::DisplayPowerState new_power_state_; |
87 | 89 |
88 // Bitwise-or-ed values for the kSetDisplayPower* values defined in | 90 // Bitwise-or-ed values for the kSetDisplayPower* values defined in |
89 // DisplayConfigurator. | 91 // DisplayConfigurator. |
90 int power_flags_; | 92 int power_flags_; |
91 | 93 |
92 uint32_t background_color_argb_; | 94 uint32_t background_color_argb_; |
93 | 95 |
94 bool force_configure_; | 96 bool force_configure_; |
95 | 97 |
| 98 bool configure_cached_displays_; |
| 99 |
96 // Used to signal that the task has finished. | 100 // Used to signal that the task has finished. |
97 ResponseCallback callback_; | 101 ResponseCallback callback_; |
98 | 102 |
99 bool force_dpms_; | 103 bool force_dpms_; |
100 | 104 |
101 // List of updated displays. | 105 // List of updated displays. |
102 std::vector<DisplaySnapshot*> cached_displays_; | 106 std::vector<DisplaySnapshot*> cached_displays_; |
103 | 107 |
104 // Vector of unowned VirtualDisplaySnapshots to be added when doing the task. | 108 // Vector of unowned VirtualDisplaySnapshots to be added when doing the task. |
105 std::vector<DisplaySnapshot*> virtual_display_snapshots_; | 109 std::vector<DisplaySnapshot*> virtual_display_snapshots_; |
106 | 110 |
107 gfx::Size framebuffer_size_; | 111 gfx::Size framebuffer_size_; |
108 | 112 |
109 std::unique_ptr<ConfigureDisplaysTask> configure_task_; | 113 std::unique_ptr<ConfigureDisplaysTask> configure_task_; |
110 | 114 |
111 base::WeakPtrFactory<UpdateDisplayConfigurationTask> weak_ptr_factory_; | 115 base::WeakPtrFactory<UpdateDisplayConfigurationTask> weak_ptr_factory_; |
112 | 116 |
113 DISALLOW_COPY_AND_ASSIGN(UpdateDisplayConfigurationTask); | 117 DISALLOW_COPY_AND_ASSIGN(UpdateDisplayConfigurationTask); |
114 }; | 118 }; |
115 | 119 |
116 } // namespace ui | 120 } // namespace ui |
117 | 121 |
118 #endif // UI_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ | 122 #endif // UI_DISPLAY_CHROMEOS_UPDATE_DISPLAY_CONFIGURATION_TASK_H_ |
OLD | NEW |