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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "chrome/browser/chromeos/display/display_preferences.h" | 24 #include "chrome/browser/chromeos/display/display_preferences.h" |
25 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
26 #include "chromeos/chromeos_switches.h" | 26 #include "chromeos/chromeos_switches.h" |
27 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
28 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
29 #include "grit/ash_strings.h" | 29 #include "grit/ash_strings.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/display/display.h" |
31 #include "ui/display/manager/display_layout.h" | 32 #include "ui/display/manager/display_layout.h" |
32 #include "ui/display/manager/display_layout_builder.h" | 33 #include "ui/display/manager/display_layout_builder.h" |
33 #include "ui/gfx/display.h" | 34 #include "ui/display/screen.h" |
34 #include "ui/gfx/geometry/rect.h" | 35 #include "ui/gfx/geometry/rect.h" |
35 #include "ui/gfx/geometry/size_conversions.h" | 36 #include "ui/gfx/geometry/size_conversions.h" |
36 #include "ui/gfx/screen.h" | |
37 | 37 |
38 namespace chromeos { | 38 namespace chromeos { |
39 namespace options { | 39 namespace options { |
40 namespace { | 40 namespace { |
41 | 41 |
42 ash::DisplayManager* GetDisplayManager() { | 42 ash::DisplayManager* GetDisplayManager() { |
43 return ash::Shell::GetInstance()->display_manager(); | 43 return ash::Shell::GetInstance()->display_manager(); |
44 } | 44 } |
45 | 45 |
46 ash::DisplayConfigurationController* GetDisplayConfigurationController() { | 46 ash::DisplayConfigurationController* GetDisplayConfigurationController() { |
47 return ash::Shell::GetInstance()->display_configuration_controller(); | 47 return ash::Shell::GetInstance()->display_configuration_controller(); |
48 } | 48 } |
49 | 49 |
50 int64_t GetDisplayIdFromValue(const base::Value* arg) { | 50 int64_t GetDisplayIdFromValue(const base::Value* arg) { |
51 std::string id_value; | 51 std::string id_value; |
52 if (!arg->GetAsString(&id_value)) | 52 if (!arg->GetAsString(&id_value)) |
53 return gfx::Display::kInvalidDisplayID; | 53 return display::Display::kInvalidDisplayID; |
54 int64_t display_id = gfx::Display::kInvalidDisplayID; | 54 int64_t display_id = display::Display::kInvalidDisplayID; |
55 if (!base::StringToInt64(id_value, &display_id)) | 55 if (!base::StringToInt64(id_value, &display_id)) |
56 return gfx::Display::kInvalidDisplayID; | 56 return display::Display::kInvalidDisplayID; |
57 return display_id; | 57 return display_id; |
58 } | 58 } |
59 | 59 |
60 int64_t GetDisplayIdFromArgs(const base::ListValue* args) { | 60 int64_t GetDisplayIdFromArgs(const base::ListValue* args) { |
61 const base::Value* arg; | 61 const base::Value* arg; |
62 if (!args->Get(0, &arg)) { | 62 if (!args->Get(0, &arg)) { |
63 LOG(ERROR) << "No display id arg"; | 63 LOG(ERROR) << "No display id arg"; |
64 return gfx::Display::kInvalidDisplayID; | 64 return display::Display::kInvalidDisplayID; |
65 } | 65 } |
66 int64_t display_id = GetDisplayIdFromValue(arg); | 66 int64_t display_id = GetDisplayIdFromValue(arg); |
67 if (display_id == gfx::Display::kInvalidDisplayID) | 67 if (display_id == display::Display::kInvalidDisplayID) |
68 LOG(ERROR) << "Invalid display id: " << *arg; | 68 LOG(ERROR) << "Invalid display id: " << *arg; |
69 return display_id; | 69 return display_id; |
70 } | 70 } |
71 | 71 |
72 int64_t GetDisplayIdFromDictionary(const base::DictionaryValue* dictionary, | 72 int64_t GetDisplayIdFromDictionary(const base::DictionaryValue* dictionary, |
73 const std::string& key) { | 73 const std::string& key) { |
74 const base::Value* arg; | 74 const base::Value* arg; |
75 if (!dictionary->Get(key, &arg)) | 75 if (!dictionary->Get(key, &arg)) |
76 return gfx::Display::kInvalidDisplayID; | 76 return display::Display::kInvalidDisplayID; |
77 return GetDisplayIdFromValue(arg); | 77 return GetDisplayIdFromValue(arg); |
78 } | 78 } |
79 | 79 |
80 base::string16 GetColorProfileName(ui::ColorCalibrationProfile profile) { | 80 base::string16 GetColorProfileName(ui::ColorCalibrationProfile profile) { |
81 switch (profile) { | 81 switch (profile) { |
82 case ui::COLOR_PROFILE_STANDARD: | 82 case ui::COLOR_PROFILE_STANDARD: |
83 return l10n_util::GetStringUTF16( | 83 return l10n_util::GetStringUTF16( |
84 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_STANDARD); | 84 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE_STANDARD); |
85 case ui::COLOR_PROFILE_DYNAMIC: | 85 case ui::COLOR_PROFILE_DYNAMIC: |
86 return l10n_util::GetStringUTF16( | 86 return l10n_util::GetStringUTF16( |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 if (!GetFloat(dict, "deviceScaleFactor", &mode->device_scale_factor)) { | 140 if (!GetFloat(dict, "deviceScaleFactor", &mode->device_scale_factor)) { |
141 LOG(ERROR) << "missing deviceScaleFactor."; | 141 LOG(ERROR) << "missing deviceScaleFactor."; |
142 return false; | 142 return false; |
143 } | 143 } |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 base::DictionaryValue* ConvertDisplayModeToValue(int64_t display_id, | 147 base::DictionaryValue* ConvertDisplayModeToValue(int64_t display_id, |
148 const ash::DisplayMode& mode) { | 148 const ash::DisplayMode& mode) { |
149 bool is_internal = gfx::Display::HasInternalDisplay() && | 149 bool is_internal = display::Display::HasInternalDisplay() && |
150 gfx::Display::InternalDisplayId() == display_id; | 150 display::Display::InternalDisplayId() == display_id; |
151 base::DictionaryValue* result = new base::DictionaryValue(); | 151 base::DictionaryValue* result = new base::DictionaryValue(); |
152 gfx::Size size_dip = mode.GetSizeInDIP(is_internal); | 152 gfx::Size size_dip = mode.GetSizeInDIP(is_internal); |
153 result->SetInteger("width", size_dip.width()); | 153 result->SetInteger("width", size_dip.width()); |
154 result->SetInteger("height", size_dip.height()); | 154 result->SetInteger("height", size_dip.height()); |
155 result->SetInteger("originalWidth", mode.size.width()); | 155 result->SetInteger("originalWidth", mode.size.width()); |
156 result->SetInteger("originalHeight", mode.size.height()); | 156 result->SetInteger("originalHeight", mode.size.height()); |
157 result->SetDouble("deviceScaleFactor", mode.device_scale_factor); | 157 result->SetDouble("deviceScaleFactor", mode.device_scale_factor); |
158 result->SetDouble("scale", mode.ui_scale); | 158 result->SetDouble("scale", mode.ui_scale); |
159 result->SetDouble("refreshRate", mode.refresh_rate); | 159 result->SetDouble("refreshRate", mode.refresh_rate); |
160 result->SetBoolean( | 160 result->SetBoolean( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 | 284 |
285 void DisplayOptionsHandler::OnDisplayConfigurationChanged() { | 285 void DisplayOptionsHandler::OnDisplayConfigurationChanged() { |
286 UpdateDisplaySettingsEnabled(); | 286 UpdateDisplaySettingsEnabled(); |
287 SendAllDisplayInfo(); | 287 SendAllDisplayInfo(); |
288 } | 288 } |
289 | 289 |
290 void DisplayOptionsHandler::SendAllDisplayInfo() { | 290 void DisplayOptionsHandler::SendAllDisplayInfo() { |
291 ash::DisplayManager* display_manager = GetDisplayManager(); | 291 ash::DisplayManager* display_manager = GetDisplayManager(); |
292 | 292 |
293 std::vector<gfx::Display> displays; | 293 std::vector<display::Display> displays; |
294 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) | 294 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) |
295 displays.push_back(display_manager->GetDisplayAt(i)); | 295 displays.push_back(display_manager->GetDisplayAt(i)); |
296 | 296 |
297 ash::DisplayManager::MultiDisplayMode display_mode; | 297 ash::DisplayManager::MultiDisplayMode display_mode; |
298 if (display_manager->IsInMirrorMode()) | 298 if (display_manager->IsInMirrorMode()) |
299 display_mode = ash::DisplayManager::MIRRORING; | 299 display_mode = ash::DisplayManager::MIRRORING; |
300 else if (display_manager->IsInUnifiedMode()) | 300 else if (display_manager->IsInUnifiedMode()) |
301 display_mode = ash::DisplayManager::UNIFIED; | 301 display_mode = ash::DisplayManager::UNIFIED; |
302 else | 302 else |
303 display_mode = ash::DisplayManager::EXTENDED; | 303 display_mode = ash::DisplayManager::EXTENDED; |
304 base::FundamentalValue mode(static_cast<int>(display_mode)); | 304 base::FundamentalValue mode(static_cast<int>(display_mode)); |
305 | 305 |
306 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); | 306 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
307 std::unique_ptr<base::ListValue> js_displays(new base::ListValue); | 307 std::unique_ptr<base::ListValue> js_displays(new base::ListValue); |
308 for (const gfx::Display& display : displays) { | 308 for (const display::Display& display : displays) { |
309 const ash::DisplayInfo& display_info = | 309 const ash::DisplayInfo& display_info = |
310 display_manager->GetDisplayInfo(display.id()); | 310 display_manager->GetDisplayInfo(display.id()); |
311 base::DictionaryValue* js_display = new base::DictionaryValue(); | 311 base::DictionaryValue* js_display = new base::DictionaryValue(); |
312 js_display->SetString("id", base::Int64ToString(display.id())); | 312 js_display->SetString("id", base::Int64ToString(display.id())); |
313 js_display->SetString("name", | 313 js_display->SetString("name", |
314 display_manager->GetDisplayNameForId(display.id())); | 314 display_manager->GetDisplayNameForId(display.id())); |
315 base::DictionaryValue* display_bounds = | 315 base::DictionaryValue* display_bounds = |
316 ConvertBoundsToValue(display.bounds()); | 316 ConvertBoundsToValue(display.bounds()); |
317 js_display->Set("bounds", display_bounds); | 317 js_display->Set("bounds", display_bounds); |
318 js_display->SetBoolean("isPrimary", display.id() == primary_id); | 318 js_display->SetBoolean("isPrimary", display.id() == primary_id); |
(...skipping 17 matching lines...) Expand all Loading... |
336 color_profile_dict->SetInteger("profileId", color_profile); | 336 color_profile_dict->SetInteger("profileId", color_profile); |
337 color_profile_dict->SetString("name", profile_name); | 337 color_profile_dict->SetString("name", profile_name); |
338 available_color_profiles->Append(color_profile_dict); | 338 available_color_profiles->Append(color_profile_dict); |
339 } | 339 } |
340 js_display->Set("availableColorProfiles", available_color_profiles); | 340 js_display->Set("availableColorProfiles", available_color_profiles); |
341 | 341 |
342 if (display_manager->GetNumDisplays() > 1) { | 342 if (display_manager->GetNumDisplays() > 1) { |
343 const display::DisplayPlacement placement = | 343 const display::DisplayPlacement placement = |
344 display_manager->GetCurrentDisplayLayout().FindPlacementById( | 344 display_manager->GetCurrentDisplayLayout().FindPlacementById( |
345 display.id()); | 345 display.id()); |
346 if (placement.display_id != gfx::Display::kInvalidDisplayID) { | 346 if (placement.display_id != display::Display::kInvalidDisplayID) { |
347 js_display->SetString( | 347 js_display->SetString( |
348 "parentId", base::Int64ToString(placement.parent_display_id)); | 348 "parentId", base::Int64ToString(placement.parent_display_id)); |
349 js_display->SetInteger("layoutType", placement.position); | 349 js_display->SetInteger("layoutType", placement.position); |
350 js_display->SetInteger("offset", placement.offset); | 350 js_display->SetInteger("offset", placement.offset); |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 js_displays->Append(js_display); | 354 js_displays->Append(js_display); |
355 } | 355 } |
356 | 356 |
(...skipping 30 matching lines...) Expand all Loading... |
387 NOTREACHED(); | 387 NOTREACHED(); |
388 content::RecordAction( | 388 content::RecordAction( |
389 base::UserMetricsAction("Options_DisplayToggleMirroring")); | 389 base::UserMetricsAction("Options_DisplayToggleMirroring")); |
390 GetDisplayConfigurationController()->SetMirrorMode(is_mirroring, | 390 GetDisplayConfigurationController()->SetMirrorMode(is_mirroring, |
391 true /* user_action */); | 391 true /* user_action */); |
392 } | 392 } |
393 | 393 |
394 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { | 394 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { |
395 DCHECK(!args->empty()); | 395 DCHECK(!args->empty()); |
396 int64_t display_id = GetDisplayIdFromArgs(args); | 396 int64_t display_id = GetDisplayIdFromArgs(args); |
397 if (display_id == gfx::Display::kInvalidDisplayID) | 397 if (display_id == display::Display::kInvalidDisplayID) |
398 return; | 398 return; |
399 | 399 |
400 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); | 400 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); |
401 GetDisplayConfigurationController()->SetPrimaryDisplayId( | 401 GetDisplayConfigurationController()->SetPrimaryDisplayId( |
402 display_id, true /* user_action */); | 402 display_id, true /* user_action */); |
403 } | 403 } |
404 | 404 |
405 void DisplayOptionsHandler::HandleSetDisplayLayout( | 405 void DisplayOptionsHandler::HandleSetDisplayLayout( |
406 const base::ListValue* args) { | 406 const base::ListValue* args) { |
407 const base::ListValue* layouts = nullptr; | 407 const base::ListValue* layouts = nullptr; |
408 if (!args->GetList(0, &layouts)) | 408 if (!args->GetList(0, &layouts)) |
409 NOTREACHED(); | 409 NOTREACHED(); |
410 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); | 410 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); |
411 | 411 |
412 ash::DisplayManager* display_manager = GetDisplayManager(); | 412 ash::DisplayManager* display_manager = GetDisplayManager(); |
413 display::DisplayLayoutBuilder builder( | 413 display::DisplayLayoutBuilder builder( |
414 display_manager->GetCurrentDisplayLayout()); | 414 display_manager->GetCurrentDisplayLayout()); |
415 builder.ClearPlacements(); | 415 builder.ClearPlacements(); |
416 for (const base::Value* layout : *layouts) { | 416 for (const base::Value* layout : *layouts) { |
417 const base::DictionaryValue* dictionary; | 417 const base::DictionaryValue* dictionary; |
418 if (!layout->GetAsDictionary(&dictionary)) { | 418 if (!layout->GetAsDictionary(&dictionary)) { |
419 LOG(ERROR) << "Invalid layout dictionary: " << *dictionary; | 419 LOG(ERROR) << "Invalid layout dictionary: " << *dictionary; |
420 continue; | 420 continue; |
421 } | 421 } |
422 | 422 |
423 int64_t parent_id = GetDisplayIdFromDictionary(dictionary, "parentId"); | 423 int64_t parent_id = GetDisplayIdFromDictionary(dictionary, "parentId"); |
424 if (parent_id == gfx::Display::kInvalidDisplayID) | 424 if (parent_id == display::Display::kInvalidDisplayID) |
425 continue; // No placement for root (primary) display. | 425 continue; // No placement for root (primary) display. |
426 | 426 |
427 int64_t display_id = GetDisplayIdFromDictionary(dictionary, "id"); | 427 int64_t display_id = GetDisplayIdFromDictionary(dictionary, "id"); |
428 if (display_id == gfx::Display::kInvalidDisplayID) { | 428 if (display_id == display::Display::kInvalidDisplayID) { |
429 LOG(ERROR) << "Invalud display id in layout dictionary: " << *dictionary; | 429 LOG(ERROR) << "Invalud display id in layout dictionary: " << *dictionary; |
430 continue; | 430 continue; |
431 } | 431 } |
432 | 432 |
433 int position = 0; | 433 int position = 0; |
434 dictionary->GetInteger("layoutType", &position); | 434 dictionary->GetInteger("layoutType", &position); |
435 int offset = 0; | 435 int offset = 0; |
436 dictionary->GetInteger("offset", &offset); | 436 dictionary->GetInteger("offset", &offset); |
437 | 437 |
438 builder.AddDisplayPlacement( | 438 builder.AddDisplayPlacement( |
439 display_id, parent_id, | 439 display_id, parent_id, |
440 static_cast<display::DisplayPlacement::Position>(position), offset); | 440 static_cast<display::DisplayPlacement::Position>(position), offset); |
441 } | 441 } |
442 std::unique_ptr<display::DisplayLayout> layout = builder.Build(); | 442 std::unique_ptr<display::DisplayLayout> layout = builder.Build(); |
443 if (!display::DisplayLayout::Validate( | 443 if (!display::DisplayLayout::Validate( |
444 display_manager->GetCurrentDisplayIdList(), *layout)) { | 444 display_manager->GetCurrentDisplayIdList(), *layout)) { |
445 LOG(ERROR) << "Invalid layout: " << layout->ToString(); | 445 LOG(ERROR) << "Invalid layout: " << layout->ToString(); |
446 return; | 446 return; |
447 } | 447 } |
448 | 448 |
449 VLOG(1) << "Updating display layout: " << layout->ToString(); | 449 VLOG(1) << "Updating display layout: " << layout->ToString(); |
450 GetDisplayConfigurationController()->SetDisplayLayout(std::move(layout), | 450 GetDisplayConfigurationController()->SetDisplayLayout(std::move(layout), |
451 true /* user_action */); | 451 true /* user_action */); |
452 } | 452 } |
453 | 453 |
454 void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) { | 454 void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) { |
455 DCHECK(!args->empty()); | 455 DCHECK(!args->empty()); |
456 | 456 |
457 int64_t display_id = GetDisplayIdFromArgs(args); | 457 int64_t display_id = GetDisplayIdFromArgs(args); |
458 if (display_id == gfx::Display::kInvalidDisplayID) | 458 if (display_id == display::Display::kInvalidDisplayID) |
459 return; | 459 return; |
460 | 460 |
461 const base::DictionaryValue* mode_data = nullptr; | 461 const base::DictionaryValue* mode_data = nullptr; |
462 if (!args->GetDictionary(1, &mode_data)) { | 462 if (!args->GetDictionary(1, &mode_data)) { |
463 LOG(ERROR) << "Failed to get mode data"; | 463 LOG(ERROR) << "Failed to get mode data"; |
464 return; | 464 return; |
465 } | 465 } |
466 | 466 |
467 ash::DisplayMode mode; | 467 ash::DisplayMode mode; |
468 if (!ConvertValueToDisplayMode(mode_data, &mode)) | 468 if (!ConvertValueToDisplayMode(mode_data, &mode)) |
469 return; | 469 return; |
470 | 470 |
471 content::RecordAction( | 471 content::RecordAction( |
472 base::UserMetricsAction("Options_DisplaySetResolution")); | 472 base::UserMetricsAction("Options_DisplaySetResolution")); |
473 ash::DisplayManager* display_manager = GetDisplayManager(); | 473 ash::DisplayManager* display_manager = GetDisplayManager(); |
474 ash::DisplayMode current_mode = | 474 ash::DisplayMode current_mode = |
475 display_manager->GetActiveModeForDisplayId(display_id); | 475 display_manager->GetActiveModeForDisplayId(display_id); |
476 if (!display_manager->SetDisplayMode(display_id, mode)) { | 476 if (!display_manager->SetDisplayMode(display_id, mode)) { |
477 LOG(ERROR) << "Unable to set display mode for: " << display_id | 477 LOG(ERROR) << "Unable to set display mode for: " << display_id |
478 << " Mode: " << *mode_data; | 478 << " Mode: " << *mode_data; |
479 return; | 479 return; |
480 } | 480 } |
481 if (gfx::Display::IsInternalDisplayId(display_id)) | 481 if (display::Display::IsInternalDisplayId(display_id)) |
482 return; | 482 return; |
483 // For external displays, show a notification confirming the resolution | 483 // For external displays, show a notification confirming the resolution |
484 // change. | 484 // change. |
485 ash::Shell::GetInstance() | 485 ash::Shell::GetInstance() |
486 ->resolution_notification_controller() | 486 ->resolution_notification_controller() |
487 ->PrepareNotification(display_id, current_mode, mode, | 487 ->PrepareNotification(display_id, current_mode, mode, |
488 base::Bind(&chromeos::StoreDisplayPrefs)); | 488 base::Bind(&chromeos::StoreDisplayPrefs)); |
489 } | 489 } |
490 | 490 |
491 void DisplayOptionsHandler::HandleSetRotation(const base::ListValue* args) { | 491 void DisplayOptionsHandler::HandleSetRotation(const base::ListValue* args) { |
492 DCHECK(!args->empty()); | 492 DCHECK(!args->empty()); |
493 | 493 |
494 int64_t display_id = GetDisplayIdFromArgs(args); | 494 int64_t display_id = GetDisplayIdFromArgs(args); |
495 if (display_id == gfx::Display::kInvalidDisplayID) | 495 if (display_id == display::Display::kInvalidDisplayID) |
496 return; | 496 return; |
497 | 497 |
498 int rotation_value = 0; | 498 int rotation_value = 0; |
499 if (!args->GetInteger(1, &rotation_value)) { | 499 if (!args->GetInteger(1, &rotation_value)) { |
500 LOG(ERROR) << "Can't parse rotation: " << args; | 500 LOG(ERROR) << "Can't parse rotation: " << args; |
501 return; | 501 return; |
502 } | 502 } |
503 gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_0; | 503 display::Display::Rotation new_rotation = display::Display::ROTATE_0; |
504 if (rotation_value == 90) | 504 if (rotation_value == 90) |
505 new_rotation = gfx::Display::ROTATE_90; | 505 new_rotation = display::Display::ROTATE_90; |
506 else if (rotation_value == 180) | 506 else if (rotation_value == 180) |
507 new_rotation = gfx::Display::ROTATE_180; | 507 new_rotation = display::Display::ROTATE_180; |
508 else if (rotation_value == 270) | 508 else if (rotation_value == 270) |
509 new_rotation = gfx::Display::ROTATE_270; | 509 new_rotation = display::Display::ROTATE_270; |
510 else if (rotation_value != 0) | 510 else if (rotation_value != 0) |
511 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; | 511 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; |
512 | 512 |
513 content::RecordAction( | 513 content::RecordAction( |
514 base::UserMetricsAction("Options_DisplaySetOrientation")); | 514 base::UserMetricsAction("Options_DisplaySetOrientation")); |
515 GetDisplayConfigurationController()->SetDisplayRotation( | 515 GetDisplayConfigurationController()->SetDisplayRotation( |
516 display_id, new_rotation, gfx::Display::ROTATION_SOURCE_USER, | 516 display_id, new_rotation, display::Display::ROTATION_SOURCE_USER, |
517 true /* user_action */); | 517 true /* user_action */); |
518 } | 518 } |
519 | 519 |
520 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { | 520 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { |
521 DCHECK(!args->empty()); | 521 DCHECK(!args->empty()); |
522 int64_t display_id = GetDisplayIdFromArgs(args); | 522 int64_t display_id = GetDisplayIdFromArgs(args); |
523 if (display_id == gfx::Display::kInvalidDisplayID) | 523 if (display_id == display::Display::kInvalidDisplayID) |
524 return; | 524 return; |
525 | 525 |
526 std::string profile_value; | 526 std::string profile_value; |
527 if (!args->GetString(1, &profile_value)) { | 527 if (!args->GetString(1, &profile_value)) { |
528 LOG(ERROR) << "Invalid profile_value"; | 528 LOG(ERROR) << "Invalid profile_value"; |
529 return; | 529 return; |
530 } | 530 } |
531 | 531 |
532 int profile_id; | 532 int profile_id; |
533 if (!base::StringToInt(profile_value, &profile_id)) { | 533 if (!base::StringToInt(profile_value, &profile_id)) { |
(...skipping 21 matching lines...) Expand all Loading... |
555 bool enable = false; | 555 bool enable = false; |
556 if (!args->GetBoolean(0, &enable)) | 556 if (!args->GetBoolean(0, &enable)) |
557 NOTREACHED(); | 557 NOTREACHED(); |
558 | 558 |
559 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 559 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
560 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); | 560 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); |
561 } | 561 } |
562 | 562 |
563 } // namespace options | 563 } // namespace options |
564 } // namespace chromeos | 564 } // namespace chromeos |
OLD | NEW |