OLD | NEW |
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/ui/webui/options/chromeos/display_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/display/display_configurator_animation.h" | 9 #include "ash/display/display_configurator_animation.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 js_display->SetString("id", base::Int64ToString(display.id())); | 272 js_display->SetString("id", base::Int64ToString(display.id())); |
273 js_display->SetInteger("x", bounds.x()); | 273 js_display->SetInteger("x", bounds.x()); |
274 js_display->SetInteger("y", bounds.y()); | 274 js_display->SetInteger("y", bounds.y()); |
275 js_display->SetInteger("width", bounds.width()); | 275 js_display->SetInteger("width", bounds.width()); |
276 js_display->SetInteger("height", bounds.height()); | 276 js_display->SetInteger("height", bounds.height()); |
277 js_display->SetString("name", | 277 js_display->SetString("name", |
278 display_manager->GetDisplayNameForId(display.id())); | 278 display_manager->GetDisplayNameForId(display.id())); |
279 js_display->SetBoolean("isPrimary", display.id() == primary_id); | 279 js_display->SetBoolean("isPrimary", display.id() == primary_id); |
280 js_display->SetBoolean("isInternal", display.IsInternal()); | 280 js_display->SetBoolean("isInternal", display.IsInternal()); |
281 js_display->SetInteger("orientation", | 281 js_display->SetInteger("orientation", |
282 static_cast<int>(display_info.rotation())); | 282 static_cast<int>(display_info.GetActiveRotation())); |
283 | 283 |
284 base::ListValue* js_resolutions = new base::ListValue(); | 284 base::ListValue* js_resolutions = new base::ListValue(); |
285 for (const ash::DisplayMode& display_mode : display_info.display_modes()) { | 285 for (const ash::DisplayMode& display_mode : display_info.display_modes()) { |
286 js_resolutions->Append( | 286 js_resolutions->Append( |
287 ConvertDisplayModeToValue(display.id(), display_mode)); | 287 ConvertDisplayModeToValue(display.id(), display_mode)); |
288 } | 288 } |
289 js_display->Set("resolutions", js_resolutions); | 289 js_display->Set("resolutions", js_resolutions); |
290 | 290 |
291 js_display->SetInteger("colorProfile", display_info.color_profile()); | 291 js_display->SetInteger("colorProfile", display_info.color_profile()); |
292 base::ListValue* available_color_profiles = new base::ListValue(); | 292 base::ListValue* available_color_profiles = new base::ListValue(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 new_rotation = gfx::Display::ROTATE_90; | 431 new_rotation = gfx::Display::ROTATE_90; |
432 else if (rotation_value == "180") | 432 else if (rotation_value == "180") |
433 new_rotation = gfx::Display::ROTATE_180; | 433 new_rotation = gfx::Display::ROTATE_180; |
434 else if (rotation_value == "270") | 434 else if (rotation_value == "270") |
435 new_rotation = gfx::Display::ROTATE_270; | 435 new_rotation = gfx::Display::ROTATE_270; |
436 else if (rotation_value != "0") | 436 else if (rotation_value != "0") |
437 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; | 437 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; |
438 | 438 |
439 content::RecordAction( | 439 content::RecordAction( |
440 base::UserMetricsAction("Options_DisplaySetOrientation")); | 440 base::UserMetricsAction("Options_DisplaySetOrientation")); |
441 ash::ScreenRotationAnimator(display_id).Rotate(new_rotation); | 441 ash::ScreenRotationAnimator(display_id) |
| 442 .Rotate(new_rotation, gfx::Display::ROTATION_SOURCE_USER); |
442 } | 443 } |
443 | 444 |
444 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { | 445 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { |
445 DCHECK(!args->empty()); | 446 DCHECK(!args->empty()); |
446 int64 display_id = GetDisplayId(args); | 447 int64 display_id = GetDisplayId(args); |
447 if (display_id == gfx::Display::kInvalidDisplayID) | 448 if (display_id == gfx::Display::kInvalidDisplayID) |
448 return; | 449 return; |
449 | 450 |
450 std::string profile_value; | 451 std::string profile_value; |
451 if (!args->GetString(1, &profile_value)) { | 452 if (!args->GetString(1, &profile_value)) { |
(...skipping 13 matching lines...) Expand all Loading... |
465 return; | 466 return; |
466 } | 467 } |
467 | 468 |
468 GetDisplayManager()->SetColorCalibrationProfile( | 469 GetDisplayManager()->SetColorCalibrationProfile( |
469 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 470 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
470 SendAllDisplayInfo(); | 471 SendAllDisplayInfo(); |
471 } | 472 } |
472 | 473 |
473 } // namespace options | 474 } // namespace options |
474 } // namespace chromeos | 475 } // namespace chromeos |
OLD | NEW |