OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FAKE_DISPLAY_DELEGATE_H_ | 5 #ifndef UI_DISPLAY_FAKE_DISPLAY_DELEGATE_H_ |
6 #define UI_DISPLAY_FAKE_DISPLAY_DELEGATE_H_ | 6 #define UI_DISPLAY_FAKE_DISPLAY_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/timer/timer.h" |
14 #include "ui/display/display_export.h" | 16 #include "ui/display/display_export.h" |
15 #include "ui/display/fake_display_snapshot.h" | 17 #include "ui/display/fake_display_snapshot.h" |
16 #include "ui/display/types/fake_display_controller.h" | 18 #include "ui/display/types/fake_display_controller.h" |
17 #include "ui/display/types/native_display_delegate.h" | 19 #include "ui/display/types/native_display_delegate.h" |
18 | 20 |
19 namespace display { | 21 namespace display { |
20 | 22 |
21 // A NativeDisplayDelegate implementation that manages fake displays. Fake | 23 // A NativeDisplayDelegate implementation that manages fake displays. Fake |
22 // displays mimic physical displays but do not actually exist. This is because | 24 // displays mimic physical displays but do not actually exist. This is because |
23 // Chrome OS does not take over the entire display when running off device and | 25 // Chrome OS does not take over the entire display when running off device and |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 protected: | 117 protected: |
116 // Sets initial display snapshots from command line flag. Returns true if the | 118 // Sets initial display snapshots from command line flag. Returns true if the |
117 // spec was parsed successfully. | 119 // spec was parsed successfully. |
118 bool InitializeFromSpecString(const std::string& str); | 120 bool InitializeFromSpecString(const std::string& str); |
119 | 121 |
120 // Updates observers when display configuration has changed. Will not update | 122 // Updates observers when display configuration has changed. Will not update |
121 // until after |Initialize()| has been called. | 123 // until after |Initialize()| has been called. |
122 void OnConfigurationChanged(); | 124 void OnConfigurationChanged(); |
123 | 125 |
124 private: | 126 private: |
| 127 // Performs callback for Configure(). |
| 128 void ConfigureDone(); |
| 129 |
125 base::ObserverList<ui::NativeDisplayObserver> observers_; | 130 base::ObserverList<ui::NativeDisplayObserver> observers_; |
126 std::vector<std::unique_ptr<ui::DisplaySnapshot>> displays_; | 131 std::vector<std::unique_ptr<ui::DisplaySnapshot>> displays_; |
127 | 132 |
128 // If |Initialize()| has been called. | 133 // Add delay before finished Configure(). |
| 134 base::OneShotTimer configure_timer_; |
| 135 base::Closure configure_callback_; |
| 136 |
| 137 // If Initialize() has been called. |
129 bool initialized_ = false; | 138 bool initialized_ = false; |
130 | 139 |
131 // The next available display id. | 140 // The next available display id. |
132 uint8_t next_display_id_ = 0; | 141 uint8_t next_display_id_ = 0; |
133 | 142 |
134 DISALLOW_COPY_AND_ASSIGN(FakeDisplayDelegate); | 143 DISALLOW_COPY_AND_ASSIGN(FakeDisplayDelegate); |
135 }; | 144 }; |
136 | 145 |
137 } // namespace display | 146 } // namespace display |
138 #endif // UI_DISPLAY_FAKE_DISPLAY_DELEGATE_H_ | 147 #endif // UI_DISPLAY_FAKE_DISPLAY_DELEGATE_H_ |
OLD | NEW |