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.Rotation( |
| 283 gfx::Display::ROTATION_SOURCE_ACTIVE))); |
283 | 284 |
284 base::ListValue* js_resolutions = new base::ListValue(); | 285 base::ListValue* js_resolutions = new base::ListValue(); |
285 for (const ash::DisplayMode& display_mode : display_info.display_modes()) { | 286 for (const ash::DisplayMode& display_mode : display_info.display_modes()) { |
286 js_resolutions->Append( | 287 js_resolutions->Append( |
287 ConvertDisplayModeToValue(display.id(), display_mode)); | 288 ConvertDisplayModeToValue(display.id(), display_mode)); |
288 } | 289 } |
289 js_display->Set("resolutions", js_resolutions); | 290 js_display->Set("resolutions", js_resolutions); |
290 | 291 |
291 js_display->SetInteger("colorProfile", display_info.color_profile()); | 292 js_display->SetInteger("colorProfile", display_info.color_profile()); |
292 base::ListValue* available_color_profiles = new base::ListValue(); | 293 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; | 432 new_rotation = gfx::Display::ROTATE_90; |
432 else if (rotation_value == "180") | 433 else if (rotation_value == "180") |
433 new_rotation = gfx::Display::ROTATE_180; | 434 new_rotation = gfx::Display::ROTATE_180; |
434 else if (rotation_value == "270") | 435 else if (rotation_value == "270") |
435 new_rotation = gfx::Display::ROTATE_270; | 436 new_rotation = gfx::Display::ROTATE_270; |
436 else if (rotation_value != "0") | 437 else if (rotation_value != "0") |
437 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; | 438 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; |
438 | 439 |
439 content::RecordAction( | 440 content::RecordAction( |
440 base::UserMetricsAction("Options_DisplaySetOrientation")); | 441 base::UserMetricsAction("Options_DisplaySetOrientation")); |
441 ash::ScreenRotationAnimator(display_id).Rotate(new_rotation); | 442 ash::ScreenRotationAnimator(display_id) |
| 443 .Rotate(new_rotation, gfx::Display::ROTATION_SOURCE_USER); |
442 } | 444 } |
443 | 445 |
444 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { | 446 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { |
445 DCHECK(!args->empty()); | 447 DCHECK(!args->empty()); |
446 int64 display_id = GetDisplayId(args); | 448 int64 display_id = GetDisplayId(args); |
447 if (display_id == gfx::Display::kInvalidDisplayID) | 449 if (display_id == gfx::Display::kInvalidDisplayID) |
448 return; | 450 return; |
449 | 451 |
450 std::string profile_value; | 452 std::string profile_value; |
451 if (!args->GetString(1, &profile_value)) { | 453 if (!args->GetString(1, &profile_value)) { |
(...skipping 13 matching lines...) Expand all Loading... |
465 return; | 467 return; |
466 } | 468 } |
467 | 469 |
468 GetDisplayManager()->SetColorCalibrationProfile( | 470 GetDisplayManager()->SetColorCalibrationProfile( |
469 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 471 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
470 SendAllDisplayInfo(); | 472 SendAllDisplayInfo(); |
471 } | 473 } |
472 | 474 |
473 } // namespace options | 475 } // namespace options |
474 } // namespace chromeos | 476 } // namespace chromeos |
OLD | NEW |