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> |
11 | 11 |
12 #include "ash/display/display_animator.h" | 12 #include "ash/display/display_configuration_controller.h" |
13 #include "ash/display/display_manager.h" | 13 #include "ash/display/display_manager.h" |
14 #include "ash/display/resolution_notification_controller.h" | 14 #include "ash/display/resolution_notification_controller.h" |
15 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
16 #include "ash/rotator/screen_rotation_animator.h" | |
17 #include "ash/shell.h" | 16 #include "ash/shell.h" |
18 #include "base/bind.h" | 17 #include "base/bind.h" |
19 #include "base/logging.h" | 18 #include "base/logging.h" |
20 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
22 #include "base/values.h" | 21 #include "base/values.h" |
23 #include "chrome/browser/chromeos/display/display_preferences.h" | 22 #include "chrome/browser/chromeos/display/display_preferences.h" |
24 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
25 #include "content/public/browser/user_metrics.h" | 24 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
27 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/gfx/display.h" | 28 #include "ui/gfx/display.h" |
30 #include "ui/gfx/geometry/rect.h" | 29 #include "ui/gfx/geometry/rect.h" |
31 #include "ui/gfx/geometry/size_conversions.h" | 30 #include "ui/gfx/geometry/size_conversions.h" |
32 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
33 | 32 |
34 using ash::DisplayManager; | |
35 | |
36 namespace chromeos { | 33 namespace chromeos { |
37 namespace options { | 34 namespace options { |
38 namespace { | 35 namespace { |
39 | 36 |
40 DisplayManager* GetDisplayManager() { | 37 ash::DisplayManager* GetDisplayManager() { |
41 return ash::Shell::GetInstance()->display_manager(); | 38 return ash::Shell::GetInstance()->display_manager(); |
42 } | 39 } |
43 | 40 |
| 41 ash::DisplayConfigurationController* GetDisplayConfigurationController() { |
| 42 return ash::Shell::GetInstance()->display_configuration_controller(); |
| 43 } |
| 44 |
44 int64_t GetDisplayId(const base::ListValue* args) { | 45 int64_t GetDisplayId(const base::ListValue* args) { |
45 // Assumes the display ID is specified as the first argument. | 46 // Assumes the display ID is specified as the first argument. |
46 std::string id_value; | 47 std::string id_value; |
47 if (!args->GetString(0, &id_value)) { | 48 if (!args->GetString(0, &id_value)) { |
48 LOG(ERROR) << "Can't find ID"; | 49 LOG(ERROR) << "Can't find ID"; |
49 return gfx::Display::kInvalidDisplayID; | 50 return gfx::Display::kInvalidDisplayID; |
50 } | 51 } |
51 | 52 |
52 int64_t display_id = gfx::Display::kInvalidDisplayID; | 53 int64_t display_id = gfx::Display::kInvalidDisplayID; |
53 if (!base::StringToInt64(id_value, &display_id)) { | 54 if (!base::StringToInt64(id_value, &display_id)) { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 web_ui()->RegisterMessageCallback( | 225 web_ui()->RegisterMessageCallback( |
225 "setMirroring", | 226 "setMirroring", |
226 base::Bind(&DisplayOptionsHandler::HandleMirroring, | 227 base::Bind(&DisplayOptionsHandler::HandleMirroring, |
227 base::Unretained(this))); | 228 base::Unretained(this))); |
228 web_ui()->RegisterMessageCallback( | 229 web_ui()->RegisterMessageCallback( |
229 "setPrimary", | 230 "setPrimary", |
230 base::Bind(&DisplayOptionsHandler::HandleSetPrimary, | 231 base::Bind(&DisplayOptionsHandler::HandleSetPrimary, |
231 base::Unretained(this))); | 232 base::Unretained(this))); |
232 web_ui()->RegisterMessageCallback( | 233 web_ui()->RegisterMessageCallback( |
233 "setDisplayLayout", | 234 "setDisplayLayout", |
234 base::Bind(&DisplayOptionsHandler::HandleDisplayLayout, | 235 base::Bind(&DisplayOptionsHandler::HandleSetDisplayLayout, |
235 base::Unretained(this))); | 236 base::Unretained(this))); |
236 web_ui()->RegisterMessageCallback( | 237 web_ui()->RegisterMessageCallback( |
237 "setDisplayMode", | 238 "setDisplayMode", |
238 base::Bind(&DisplayOptionsHandler::HandleSetDisplayMode, | 239 base::Bind(&DisplayOptionsHandler::HandleSetDisplayMode, |
239 base::Unretained(this))); | 240 base::Unretained(this))); |
240 web_ui()->RegisterMessageCallback( | 241 web_ui()->RegisterMessageCallback( |
241 "setOrientation", | 242 "setOrientation", |
242 base::Bind(&DisplayOptionsHandler::HandleSetOrientation, | 243 base::Bind(&DisplayOptionsHandler::HandleSetOrientation, |
243 base::Unretained(this))); | 244 base::Unretained(this))); |
244 web_ui()->RegisterMessageCallback( | 245 web_ui()->RegisterMessageCallback( |
245 "setColorProfile", | 246 "setColorProfile", |
246 base::Bind(&DisplayOptionsHandler::HandleSetColorProfile, | 247 base::Bind(&DisplayOptionsHandler::HandleSetColorProfile, |
247 base::Unretained(this))); | 248 base::Unretained(this))); |
248 web_ui()->RegisterMessageCallback( | 249 web_ui()->RegisterMessageCallback( |
249 "setUnifiedDesktopEnabled", | 250 "setUnifiedDesktopEnabled", |
250 base::Bind(&DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled, | 251 base::Bind(&DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled, |
251 base::Unretained(this))); | 252 base::Unretained(this))); |
252 } | 253 } |
253 | 254 |
254 void DisplayOptionsHandler::OnDisplayConfigurationChanging() { | 255 void DisplayOptionsHandler::OnDisplayConfigurationChanging() { |
255 } | 256 } |
256 | 257 |
257 void DisplayOptionsHandler::OnDisplayConfigurationChanged() { | 258 void DisplayOptionsHandler::OnDisplayConfigurationChanged() { |
258 UpdateDisplaySettingsEnabled(); | 259 UpdateDisplaySettingsEnabled(); |
259 SendAllDisplayInfo(); | 260 SendAllDisplayInfo(); |
260 } | 261 } |
261 | 262 |
262 void DisplayOptionsHandler::SendAllDisplayInfo() { | 263 void DisplayOptionsHandler::SendAllDisplayInfo() { |
263 DisplayManager* display_manager = GetDisplayManager(); | 264 ash::DisplayManager* display_manager = GetDisplayManager(); |
264 | 265 |
265 std::vector<gfx::Display> displays; | 266 std::vector<gfx::Display> displays; |
266 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) | 267 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) |
267 displays.push_back(display_manager->GetDisplayAt(i)); | 268 displays.push_back(display_manager->GetDisplayAt(i)); |
268 SendDisplayInfo(displays); | 269 SendDisplayInfo(displays); |
269 } | 270 } |
270 | 271 |
271 void DisplayOptionsHandler::SendDisplayInfo( | 272 void DisplayOptionsHandler::SendDisplayInfo( |
272 const std::vector<gfx::Display>& displays) { | 273 const std::vector<gfx::Display>& displays) { |
273 DisplayManager* display_manager = GetDisplayManager(); | 274 ash::DisplayManager* display_manager = GetDisplayManager(); |
274 base::FundamentalValue mode( | 275 ash::DisplayManager::MultiDisplayMode display_mode; |
275 display_manager->IsInMirrorMode() ? DisplayManager::MIRRORING : | 276 if (display_manager->IsInMirrorMode()) |
276 (display_manager->IsInUnifiedMode() ? DisplayManager::UNIFIED : | 277 display_mode = ash::DisplayManager::MIRRORING; |
277 DisplayManager::EXTENDED)); | 278 else if (display_manager->IsInUnifiedMode()) |
278 | 279 display_mode = ash::DisplayManager::UNIFIED; |
| 280 else |
| 281 display_mode = ash::DisplayManager::EXTENDED; |
| 282 base::FundamentalValue mode(static_cast<int>(display_mode)); |
279 int64_t primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); | 283 int64_t primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); |
280 base::ListValue js_displays; | 284 base::ListValue js_displays; |
281 for (const gfx::Display& display : displays) { | 285 for (const gfx::Display& display : displays) { |
282 const ash::DisplayInfo& display_info = | 286 const ash::DisplayInfo& display_info = |
283 display_manager->GetDisplayInfo(display.id()); | 287 display_manager->GetDisplayInfo(display.id()); |
284 const gfx::Rect& bounds = display.bounds(); | 288 const gfx::Rect& bounds = display.bounds(); |
285 base::DictionaryValue* js_display = new base::DictionaryValue(); | 289 base::DictionaryValue* js_display = new base::DictionaryValue(); |
286 js_display->SetString("id", base::Int64ToString(display.id())); | 290 js_display->SetString("id", base::Int64ToString(display.id())); |
287 js_display->SetInteger("x", bounds.x()); | 291 js_display->SetInteger("x", bounds.x()); |
288 js_display->SetInteger("y", bounds.y()); | 292 js_display->SetInteger("y", bounds.y()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { | 338 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { |
335 bool enabled = GetDisplayManager()->num_connected_displays() <= 2; | 339 bool enabled = GetDisplayManager()->num_connected_displays() <= 2; |
336 bool show_unified_desktop = GetDisplayManager()->unified_desktop_enabled(); | 340 bool show_unified_desktop = GetDisplayManager()->unified_desktop_enabled(); |
337 | 341 |
338 web_ui()->CallJavascriptFunction( | 342 web_ui()->CallJavascriptFunction( |
339 "options.BrowserOptions.enableDisplaySettings", | 343 "options.BrowserOptions.enableDisplaySettings", |
340 base::FundamentalValue(enabled), | 344 base::FundamentalValue(enabled), |
341 base::FundamentalValue(show_unified_desktop)); | 345 base::FundamentalValue(show_unified_desktop)); |
342 } | 346 } |
343 | 347 |
344 void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) { | |
345 ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring); | |
346 // Not necessary to start fade-in animation. DisplayConfigurator will do that. | |
347 } | |
348 | |
349 void DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished( | |
350 int position, int offset) { | |
351 SetCurrentDisplayLayout( | |
352 ash::DisplayLayout::FromInts(position, offset)); | |
353 ash::Shell::GetInstance()->display_animator()->StartFadeInAnimation(); | |
354 } | |
355 | |
356 void DisplayOptionsHandler::HandleDisplayInfo( | 348 void DisplayOptionsHandler::HandleDisplayInfo( |
357 const base::ListValue* unused_args) { | 349 const base::ListValue* unused_args) { |
358 SendAllDisplayInfo(); | 350 SendAllDisplayInfo(); |
359 } | 351 } |
360 | 352 |
361 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { | 353 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { |
362 DCHECK(!args->empty()); | 354 DCHECK(!args->empty()); |
| 355 bool is_mirroring = false; |
| 356 if (!args->GetBoolean(0, &is_mirroring)) |
| 357 NOTREACHED(); |
363 content::RecordAction( | 358 content::RecordAction( |
364 base::UserMetricsAction("Options_DisplayToggleMirroring")); | 359 base::UserMetricsAction("Options_DisplayToggleMirroring")); |
365 bool is_mirroring = false; | 360 GetDisplayConfigurationController()->SetMirrorMode(is_mirroring, |
366 args->GetBoolean(0, &is_mirroring); | 361 true /* user_action */); |
367 ash::Shell::GetInstance()->display_animator()->StartFadeOutAnimation( | |
368 base::Bind(&DisplayOptionsHandler::OnFadeOutForMirroringFinished, | |
369 base::Unretained(this), is_mirroring)); | |
370 } | 362 } |
371 | 363 |
372 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { | 364 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { |
373 DCHECK(!args->empty()); | 365 DCHECK(!args->empty()); |
374 int64_t display_id = GetDisplayId(args); | 366 int64_t display_id = GetDisplayId(args); |
375 if (display_id == gfx::Display::kInvalidDisplayID) | 367 if (display_id == gfx::Display::kInvalidDisplayID) |
376 return; | 368 return; |
377 | 369 |
378 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); | 370 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); |
379 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 371 GetDisplayConfigurationController()->SetPrimaryDisplayId( |
380 display_id); | 372 display_id, true /* user_action */); |
381 } | 373 } |
382 | 374 |
383 void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) { | 375 void DisplayOptionsHandler::HandleSetDisplayLayout( |
384 double layout = -1; | 376 const base::ListValue* args) { |
385 double offset = -1; | 377 int64_t display_id = GetDisplayId(args); |
386 if (!args->GetDouble(0, &layout) || !args->GetDouble(1, &offset)) { | 378 int layout, offset; |
387 LOG(ERROR) << "Invalid parameter"; | 379 if (!args->GetInteger(1, &layout)) |
388 SendAllDisplayInfo(); | 380 NOTREACHED(); |
389 return; | |
390 } | |
391 DCHECK_LE(ash::DisplayLayout::TOP, layout); | 381 DCHECK_LE(ash::DisplayLayout::TOP, layout); |
392 DCHECK_GE(ash::DisplayLayout::LEFT, layout); | 382 DCHECK_GE(ash::DisplayLayout::LEFT, layout); |
| 383 if (!args->GetInteger(2, &offset)) |
| 384 NOTREACHED(); |
393 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); | 385 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); |
394 ash::Shell::GetInstance()->display_animator()->StartFadeOutAnimation( | 386 GetDisplayConfigurationController()->SetDisplayLayout( |
395 base::Bind(&DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished, | 387 display_id, ash::DisplayLayout::FromInts(layout, offset), |
396 base::Unretained(this), static_cast<int>(layout), | 388 true /* user_action */); |
397 static_cast<int>(offset))); | |
398 } | 389 } |
399 | 390 |
400 void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) { | 391 void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) { |
401 DCHECK(!args->empty()); | 392 DCHECK(!args->empty()); |
402 | 393 |
403 int64_t display_id = GetDisplayId(args); | 394 int64_t display_id = GetDisplayId(args); |
404 if (display_id == gfx::Display::kInvalidDisplayID) | 395 if (display_id == gfx::Display::kInvalidDisplayID) |
405 return; | 396 return; |
406 | 397 |
407 const base::DictionaryValue* mode_data = nullptr; | 398 const base::DictionaryValue* mode_data = nullptr; |
408 if (!args->GetDictionary(1, &mode_data)) { | 399 if (!args->GetDictionary(1, &mode_data)) { |
409 LOG(ERROR) << "Failed to get mode data"; | 400 LOG(ERROR) << "Failed to get mode data"; |
410 return; | 401 return; |
411 } | 402 } |
412 | 403 |
413 ash::DisplayMode mode; | 404 ash::DisplayMode mode; |
414 if (!ConvertValueToDisplayMode(mode_data, &mode)) | 405 if (!ConvertValueToDisplayMode(mode_data, &mode)) |
415 return; | 406 return; |
416 | 407 |
417 content::RecordAction( | 408 content::RecordAction( |
418 base::UserMetricsAction("Options_DisplaySetResolution")); | 409 base::UserMetricsAction("Options_DisplaySetResolution")); |
419 ash::DisplayManager* display_manager = GetDisplayManager(); | 410 ash::DisplayManager* display_manager = GetDisplayManager(); |
420 ash::DisplayMode current_mode = | 411 ash::DisplayMode current_mode = |
421 display_manager->GetActiveModeForDisplayId(display_id); | 412 display_manager->GetActiveModeForDisplayId(display_id); |
422 if (display_manager->SetDisplayMode(display_id, mode) && | 413 if (!display_manager->SetDisplayMode(display_id, mode)) { |
423 !gfx::Display::IsInternalDisplayId(display_id)) { | 414 LOG(ERROR) << "Unable to set display mode for: " << display_id |
424 ash::Shell::GetInstance()->resolution_notification_controller()-> | 415 << " Mode: " << *mode_data; |
425 PrepareNotification( | 416 return; |
426 display_id, current_mode, mode, base::Bind(&StoreDisplayPrefs)); | |
427 } | 417 } |
| 418 if (gfx::Display::IsInternalDisplayId(display_id)) |
| 419 return; |
| 420 // For external displays, show a notification confirming the resolution |
| 421 // change. |
| 422 ash::Shell::GetInstance() |
| 423 ->resolution_notification_controller() |
| 424 ->PrepareNotification(display_id, current_mode, mode, |
| 425 base::Bind(&chromeos::StoreDisplayPrefs)); |
428 } | 426 } |
429 | 427 |
430 void DisplayOptionsHandler::HandleSetOrientation(const base::ListValue* args) { | 428 void DisplayOptionsHandler::HandleSetOrientation(const base::ListValue* args) { |
431 DCHECK(!args->empty()); | 429 DCHECK(!args->empty()); |
432 | 430 |
433 int64_t display_id = GetDisplayId(args); | 431 int64_t display_id = GetDisplayId(args); |
434 if (display_id == gfx::Display::kInvalidDisplayID) | 432 if (display_id == gfx::Display::kInvalidDisplayID) |
435 return; | 433 return; |
436 | 434 |
437 std::string rotation_value; | 435 std::string rotation_value; |
438 gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_0; | 436 gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_0; |
439 if (!args->GetString(1, &rotation_value)) { | 437 if (!args->GetString(1, &rotation_value)) { |
440 LOG(ERROR) << "Can't find new orientation"; | 438 LOG(ERROR) << "Can't find new orientation"; |
441 return; | 439 return; |
442 } | 440 } |
443 if (rotation_value == "90") | 441 if (rotation_value == "90") |
444 new_rotation = gfx::Display::ROTATE_90; | 442 new_rotation = gfx::Display::ROTATE_90; |
445 else if (rotation_value == "180") | 443 else if (rotation_value == "180") |
446 new_rotation = gfx::Display::ROTATE_180; | 444 new_rotation = gfx::Display::ROTATE_180; |
447 else if (rotation_value == "270") | 445 else if (rotation_value == "270") |
448 new_rotation = gfx::Display::ROTATE_270; | 446 new_rotation = gfx::Display::ROTATE_270; |
449 else if (rotation_value != "0") | 447 else if (rotation_value != "0") |
450 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; | 448 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; |
451 | 449 |
452 content::RecordAction( | 450 content::RecordAction( |
453 base::UserMetricsAction("Options_DisplaySetOrientation")); | 451 base::UserMetricsAction("Options_DisplaySetOrientation")); |
454 ash::ScreenRotationAnimator(display_id) | 452 GetDisplayConfigurationController()->SetDisplayRotation( |
455 .Rotate(new_rotation, gfx::Display::ROTATION_SOURCE_USER); | 453 display_id, new_rotation, gfx::Display::ROTATION_SOURCE_USER, |
| 454 true /* user_action */); |
456 } | 455 } |
457 | 456 |
458 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { | 457 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { |
459 DCHECK(!args->empty()); | 458 DCHECK(!args->empty()); |
460 int64_t display_id = GetDisplayId(args); | 459 int64_t display_id = GetDisplayId(args); |
461 if (display_id == gfx::Display::kInvalidDisplayID) | 460 if (display_id == gfx::Display::kInvalidDisplayID) |
462 return; | 461 return; |
463 | 462 |
464 std::string profile_value; | 463 std::string profile_value; |
465 if (!args->GetString(1, &profile_value)) { | 464 if (!args->GetString(1, &profile_value)) { |
466 LOG(ERROR) << "Invalid profile_value"; | 465 LOG(ERROR) << "Invalid profile_value"; |
467 return; | 466 return; |
468 } | 467 } |
469 | 468 |
470 int profile_id; | 469 int profile_id; |
471 if (!base::StringToInt(profile_value, &profile_id)) { | 470 if (!base::StringToInt(profile_value, &profile_id)) { |
472 LOG(ERROR) << "Invalid profile: " << profile_value; | 471 LOG(ERROR) << "Invalid profile: " << profile_value; |
473 return; | 472 return; |
474 } | 473 } |
475 | 474 |
476 if (profile_id < ui::COLOR_PROFILE_STANDARD || | 475 if (profile_id < ui::COLOR_PROFILE_STANDARD || |
477 profile_id > ui::COLOR_PROFILE_READING) { | 476 profile_id > ui::COLOR_PROFILE_READING) { |
478 LOG(ERROR) << "Invalid profile_id: " << profile_id; | 477 LOG(ERROR) << "Invalid profile_id: " << profile_id; |
479 return; | 478 return; |
480 } | 479 } |
481 | 480 |
| 481 content::RecordAction( |
| 482 base::UserMetricsAction("Options_DisplaySetColorProfile")); |
482 GetDisplayManager()->SetColorCalibrationProfile( | 483 GetDisplayManager()->SetColorCalibrationProfile( |
483 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 484 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
| 485 |
484 SendAllDisplayInfo(); | 486 SendAllDisplayInfo(); |
485 } | 487 } |
486 | 488 |
487 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled( | 489 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled( |
488 const base::ListValue* args) { | 490 const base::ListValue* args) { |
489 DCHECK(GetDisplayManager()->unified_desktop_enabled()); | 491 DCHECK(GetDisplayManager()->unified_desktop_enabled()); |
490 bool enable = false; | 492 bool enable = false; |
491 if (args->GetBoolean(0, &enable)) { | 493 if (!args->GetBoolean(0, &enable)) |
492 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 494 NOTREACHED(); |
493 enable ? DisplayManager::UNIFIED : DisplayManager::EXTENDED); | 495 |
494 GetDisplayManager()->ReconfigureDisplays(); | 496 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
495 } | 497 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); |
496 } | 498 } |
497 | 499 |
498 } // namespace options | 500 } // namespace options |
499 } // namespace chromeos | 501 } // namespace chromeos |
OLD | NEW |