Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: ui/display/chromeos/display_configurator.cc

Issue 383463002: Don't bother asking the platform for the delegates if they are already set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (native_display_delegate_) 157 if (native_display_delegate_)
158 native_display_delegate_->RemoveObserver(this); 158 native_display_delegate_->RemoveObserver(this);
159 } 159 }
160 160
161 void DisplayConfigurator::SetDelegatesForTesting( 161 void DisplayConfigurator::SetDelegatesForTesting(
162 scoped_ptr<NativeDisplayDelegate> display_delegate, 162 scoped_ptr<NativeDisplayDelegate> display_delegate,
163 scoped_ptr<TouchscreenDelegate> touchscreen_delegate) { 163 scoped_ptr<TouchscreenDelegate> touchscreen_delegate) {
164 DCHECK(!native_display_delegate_); 164 DCHECK(!native_display_delegate_);
165 DCHECK(!touchscreen_delegate_); 165 DCHECK(!touchscreen_delegate_);
166 166
167 InitializeDelegates(display_delegate.Pass(), touchscreen_delegate.Pass()); 167 native_display_delegate_ = display_delegate.Pass();
168 touchscreen_delegate_ = touchscreen_delegate.Pass();
168 configure_display_ = true; 169 configure_display_ = true;
169 } 170 }
170 171
171 void DisplayConfigurator::SetInitialDisplayPower( 172 void DisplayConfigurator::SetInitialDisplayPower(
172 chromeos::DisplayPowerState power_state) { 173 chromeos::DisplayPowerState power_state) {
173 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID); 174 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID);
174 power_state_ = power_state; 175 power_state_ = power_state;
175 } 176 }
176 177
177 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { 178 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) {
178 is_panel_fitting_enabled_ = is_panel_fitting_enabled; 179 is_panel_fitting_enabled_ = is_panel_fitting_enabled;
179 if (!configure_display_) 180 if (!configure_display_)
180 return; 181 return;
181 182
182 PlatformInitialize(); 183 // If the delegates are already initialized don't update them (For example,
183 } 184 // tests set their own delegates).
184
185 void DisplayConfigurator::InitializeDelegates(
186 scoped_ptr<NativeDisplayDelegate> display_delegate,
187 scoped_ptr<TouchscreenDelegate> touchscreen_delegate) {
188 if (!native_display_delegate_ && !touchscreen_delegate_) { 185 if (!native_display_delegate_ && !touchscreen_delegate_) {
189 native_display_delegate_ = display_delegate.Pass(); 186 native_display_delegate_ = CreatePlatformNativeDisplayDelegate();
Daniel Erat 2014/07/09 21:17:23 nit: probably safer to do this now: if (!native
dnicoara 2014/07/09 21:21:50 Done.
190 touchscreen_delegate_ = touchscreen_delegate.Pass(); 187 touchscreen_delegate_ = CreatePlatformTouchscreenDelegate();
191 188
192 native_display_delegate_->AddObserver(this); 189 native_display_delegate_->AddObserver(this);
193 } 190 }
194 } 191 }
195 192
196 void DisplayConfigurator::ForceInitialConfigure( 193 void DisplayConfigurator::ForceInitialConfigure(
197 uint32_t background_color_argb) { 194 uint32_t background_color_argb) {
198 if (!configure_display_) 195 if (!configure_display_)
199 return; 196 return;
200 197
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return state_controller_->GetStateForDisplayIds(display_ids); 930 return state_controller_->GetStateForDisplayIds(display_ids);
934 } 931 }
935 } 932 }
936 default: 933 default:
937 NOTREACHED(); 934 NOTREACHED();
938 } 935 }
939 return MULTIPLE_DISPLAY_STATE_INVALID; 936 return MULTIPLE_DISPLAY_STATE_INVALID;
940 } 937 }
941 938
942 } // namespace ui 939 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/ozone/display_configurator_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698