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

Side by Side Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 2613493002: Fix namespace for src/ui/display/. (Closed)
Patch Set: Rebase. Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/display/display_pref_util.h" 9 #include "ash/display/display_pref_util.h"
10 #include "ash/display/json_converter.h" 10 #include "ash/display/json_converter.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (row != touch_calibration_data.point_pairs.size() - 1) 144 if (row != touch_calibration_data.point_pairs.size() - 1)
145 str += " "; 145 str += " ";
146 } 146 }
147 value->SetString(kTouchCalibrationPointPairs, str); 147 value->SetString(kTouchCalibrationPointPairs, str);
148 value->SetInteger(kTouchCalibrationWidth, 148 value->SetInteger(kTouchCalibrationWidth,
149 touch_calibration_data.bounds.width()); 149 touch_calibration_data.bounds.width());
150 value->SetInteger(kTouchCalibrationHeight, 150 value->SetInteger(kTouchCalibrationHeight,
151 touch_calibration_data.bounds.height()); 151 touch_calibration_data.bounds.height());
152 } 152 }
153 153
154 std::string ColorProfileToString(ui::ColorCalibrationProfile profile) { 154 std::string ColorProfileToString(display::ColorCalibrationProfile profile) {
155 switch (profile) { 155 switch (profile) {
156 case ui::COLOR_PROFILE_STANDARD: 156 case display::COLOR_PROFILE_STANDARD:
157 return "standard"; 157 return "standard";
158 case ui::COLOR_PROFILE_DYNAMIC: 158 case display::COLOR_PROFILE_DYNAMIC:
159 return "dynamic"; 159 return "dynamic";
160 case ui::COLOR_PROFILE_MOVIE: 160 case display::COLOR_PROFILE_MOVIE:
161 return "movie"; 161 return "movie";
162 case ui::COLOR_PROFILE_READING: 162 case display::COLOR_PROFILE_READING:
163 return "reading"; 163 return "reading";
164 case ui::NUM_COLOR_PROFILES: 164 case display::NUM_COLOR_PROFILES:
165 break; 165 break;
166 } 166 }
167 NOTREACHED(); 167 NOTREACHED();
168 return ""; 168 return "";
169 } 169 }
170 170
171 ui::ColorCalibrationProfile StringToColorProfile(const std::string& value) { 171 display::ColorCalibrationProfile StringToColorProfile(
172 const std::string& value) {
172 if (value == "standard") 173 if (value == "standard")
173 return ui::COLOR_PROFILE_STANDARD; 174 return display::COLOR_PROFILE_STANDARD;
174 else if (value == "dynamic") 175 else if (value == "dynamic")
175 return ui::COLOR_PROFILE_DYNAMIC; 176 return display::COLOR_PROFILE_DYNAMIC;
176 else if (value == "movie") 177 else if (value == "movie")
177 return ui::COLOR_PROFILE_MOVIE; 178 return display::COLOR_PROFILE_MOVIE;
178 else if (value == "reading") 179 else if (value == "reading")
179 return ui::COLOR_PROFILE_READING; 180 return display::COLOR_PROFILE_READING;
180 NOTREACHED(); 181 NOTREACHED();
181 return ui::COLOR_PROFILE_STANDARD; 182 return display::COLOR_PROFILE_STANDARD;
182 } 183 }
183 184
184 display::DisplayManager* GetDisplayManager() { 185 display::DisplayManager* GetDisplayManager() {
185 return ash::Shell::GetInstance()->display_manager(); 186 return ash::Shell::GetInstance()->display_manager();
186 } 187 }
187 188
188 // Returns true id the current user can write display preferences to 189 // Returns true id the current user can write display preferences to
189 // Local State. 190 // Local State.
190 bool UserCanSaveDisplayPreference() { 191 bool UserCanSaveDisplayPreference() {
191 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 192 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 266
266 gfx::Insets insets; 267 gfx::Insets insets;
267 if (ValueToInsets(*dict_value, &insets)) 268 if (ValueToInsets(*dict_value, &insets))
268 insets_to_set = &insets; 269 insets_to_set = &insets;
269 270
270 display::TouchCalibrationData calibration_data; 271 display::TouchCalibrationData calibration_data;
271 display::TouchCalibrationData* calibration_data_to_set = nullptr; 272 display::TouchCalibrationData* calibration_data_to_set = nullptr;
272 if (ValueToTouchData(*dict_value, &calibration_data)) 273 if (ValueToTouchData(*dict_value, &calibration_data))
273 calibration_data_to_set = &calibration_data; 274 calibration_data_to_set = &calibration_data;
274 275
275 ui::ColorCalibrationProfile color_profile = ui::COLOR_PROFILE_STANDARD; 276 display::ColorCalibrationProfile color_profile =
277 display::COLOR_PROFILE_STANDARD;
276 std::string color_profile_name; 278 std::string color_profile_name;
277 if (dict_value->GetString("color_profile_name", &color_profile_name)) 279 if (dict_value->GetString("color_profile_name", &color_profile_name))
278 color_profile = StringToColorProfile(color_profile_name); 280 color_profile = StringToColorProfile(color_profile_name);
279 GetDisplayManager()->RegisterDisplayProperty( 281 GetDisplayManager()->RegisterDisplayProperty(
280 id, rotation, ui_scale, insets_to_set, resolution_in_pixels, 282 id, rotation, ui_scale, insets_to_set, resolution_in_pixels,
281 device_scale_factor, color_profile, calibration_data_to_set); 283 device_scale_factor, color_profile, calibration_data_to_set);
282 } 284 }
283 } 285 }
284 286
285 void LoadDisplayRotationState() { 287 void LoadDisplayRotationState() {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 display_manager->GetSelectedModeForDisplayId(id); 360 display_manager->GetSelectedModeForDisplayId(id);
359 if (!display.IsInternal() && mode && !mode->native()) { 361 if (!display.IsInternal() && mode && !mode->native()) {
360 property_value->SetInteger("width", mode->size().width()); 362 property_value->SetInteger("width", mode->size().width());
361 property_value->SetInteger("height", mode->size().height()); 363 property_value->SetInteger("height", mode->size().height());
362 property_value->SetInteger( 364 property_value->SetInteger(
363 "device-scale-factor", 365 "device-scale-factor",
364 static_cast<int>(mode->device_scale_factor() * 1000)); 366 static_cast<int>(mode->device_scale_factor() * 1000));
365 } 367 }
366 if (!info.overscan_insets_in_dip().IsEmpty()) 368 if (!info.overscan_insets_in_dip().IsEmpty())
367 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); 369 InsetsToValue(info.overscan_insets_in_dip(), property_value.get());
368 if (info.color_profile() != ui::COLOR_PROFILE_STANDARD) { 370 if (info.color_profile() != display::COLOR_PROFILE_STANDARD) {
369 property_value->SetString( 371 property_value->SetString(
370 "color_profile_name", ColorProfileToString(info.color_profile())); 372 "color_profile_name", ColorProfileToString(info.color_profile()));
371 } 373 }
372 if (info.has_touch_calibration_data()) 374 if (info.has_touch_calibration_data())
373 TouchDataToValue(info.GetTouchCalibrationData(), property_value.get()); 375 TouchDataToValue(info.GetTouchCalibrationData(), property_value.get());
374 pref_data->Set(base::Int64ToString(id), property_value.release()); 376 pref_data->Set(base::Int64ToString(id), property_value.release());
375 } 377 }
376 } 378 }
377 379
378 typedef std::map<chromeos::DisplayPowerState, std::string> 380 typedef std::map<chromeos::DisplayPowerState, std::string>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 StoreDisplayPowerState(power_state); 491 StoreDisplayPowerState(power_state);
490 } 492 }
491 493
492 bool ParseTouchCalibrationStringForTest( 494 bool ParseTouchCalibrationStringForTest(
493 const std::string& str, 495 const std::string& str,
494 display::TouchCalibrationData::CalibrationPointPairQuad* point_pair_quad) { 496 display::TouchCalibrationData::CalibrationPointPairQuad* point_pair_quad) {
495 return ParseTouchCalibrationStringValue(str, point_pair_quad); 497 return ParseTouchCalibrationStringValue(str, point_pair_quad);
496 } 498 }
497 499
498 } // namespace chromeos 500 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698