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 #include "ui/display/chromeos/display_configurator.h" | 5 #include "ui/display/chromeos/display_configurator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 chromeos::DisplayPowerState power_state) { | 172 chromeos::DisplayPowerState power_state) { |
173 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID); | 173 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID); |
174 power_state_ = power_state; | 174 power_state_ = power_state; |
175 } | 175 } |
176 | 176 |
177 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { | 177 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { |
178 is_panel_fitting_enabled_ = is_panel_fitting_enabled; | 178 is_panel_fitting_enabled_ = is_panel_fitting_enabled; |
179 if (!configure_display_) | 179 if (!configure_display_) |
180 return; | 180 return; |
181 | 181 |
182 PlatformInitialize(); | 182 // If the delegates are already initialized don't update them (For example, |
183 // tests set their own delegates). | |
184 if (!native_display_delegate_ && !touchscreen_delegate_) | |
185 PlatformInitialize(); | |
Daniel Erat
2014/07/09 18:11:24
i'm concerned that someone further down the line w
dnicoara
2014/07/09 19:24:36
Hmm, I don't really want to add too much complexit
| |
183 } | 186 } |
184 | 187 |
185 void DisplayConfigurator::InitializeDelegates( | 188 void DisplayConfigurator::InitializeDelegates( |
186 scoped_ptr<NativeDisplayDelegate> display_delegate, | 189 scoped_ptr<NativeDisplayDelegate> display_delegate, |
187 scoped_ptr<TouchscreenDelegate> touchscreen_delegate) { | 190 scoped_ptr<TouchscreenDelegate> touchscreen_delegate) { |
188 if (!native_display_delegate_ && !touchscreen_delegate_) { | 191 native_display_delegate_ = display_delegate.Pass(); |
189 native_display_delegate_ = display_delegate.Pass(); | 192 touchscreen_delegate_ = touchscreen_delegate.Pass(); |
190 touchscreen_delegate_ = touchscreen_delegate.Pass(); | |
191 | 193 |
192 native_display_delegate_->AddObserver(this); | 194 native_display_delegate_->AddObserver(this); |
193 } | |
194 } | 195 } |
195 | 196 |
196 void DisplayConfigurator::ForceInitialConfigure( | 197 void DisplayConfigurator::ForceInitialConfigure( |
197 uint32_t background_color_argb) { | 198 uint32_t background_color_argb) { |
198 if (!configure_display_) | 199 if (!configure_display_) |
199 return; | 200 return; |
200 | 201 |
201 native_display_delegate_->GrabServer(); | 202 native_display_delegate_->GrabServer(); |
202 native_display_delegate_->Initialize(); | 203 native_display_delegate_->Initialize(); |
203 | 204 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
933 return state_controller_->GetStateForDisplayIds(display_ids); | 934 return state_controller_->GetStateForDisplayIds(display_ids); |
934 } | 935 } |
935 } | 936 } |
936 default: | 937 default: |
937 NOTREACHED(); | 938 NOTREACHED(); |
938 } | 939 } |
939 return MULTIPLE_DISPLAY_STATE_INVALID; | 940 return MULTIPLE_DISPLAY_STATE_INVALID; |
940 } | 941 } |
941 | 942 |
942 } // namespace ui | 943 } // namespace ui |
OLD | NEW |