| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 js_displays->Append(js_display); | 353 js_displays->Append(js_display); |
| 354 } | 354 } |
| 355 | 355 |
| 356 web_ui()->CallJavascriptFunction("options.DisplayOptions.setDisplayInfo", | 356 web_ui()->CallJavascriptFunction("options.DisplayOptions.setDisplayInfo", |
| 357 mode, *js_displays); | 357 mode, *js_displays); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { | 360 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { |
| 361 ash::DisplayManager* display_manager = GetDisplayManager(); |
| 361 bool disable_multi_display_layout = | 362 bool disable_multi_display_layout = |
| 362 base::CommandLine::ForCurrentProcess()->HasSwitch( | 363 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 363 chromeos::switches::kDisableMultiDisplayLayout); | 364 chromeos::switches::kDisableMultiDisplayLayout); |
| 364 bool enabled = !(disable_multi_display_layout && | 365 bool ui_enabled = display_manager->num_connected_displays() <= 2 || |
| 365 GetDisplayManager()->num_connected_displays() > 2); | 366 !disable_multi_display_layout; |
| 366 bool show_unified_desktop = GetDisplayManager()->unified_desktop_enabled(); | 367 bool unified_enabled = display_manager->unified_desktop_enabled(); |
| 368 bool mirrored_enabled = display_manager->num_connected_displays() == 2; |
| 367 | 369 |
| 368 web_ui()->CallJavascriptFunction( | 370 web_ui()->CallJavascriptFunction( |
| 369 "options.BrowserOptions.enableDisplaySettings", | 371 "options.BrowserOptions.enableDisplaySettings", |
| 370 base::FundamentalValue(enabled), | 372 base::FundamentalValue(ui_enabled), |
| 371 base::FundamentalValue(show_unified_desktop)); | 373 base::FundamentalValue(unified_enabled), |
| 374 base::FundamentalValue(mirrored_enabled)); |
| 372 } | 375 } |
| 373 | 376 |
| 374 void DisplayOptionsHandler::HandleDisplayInfo( | 377 void DisplayOptionsHandler::HandleDisplayInfo( |
| 375 const base::ListValue* unused_args) { | 378 const base::ListValue* unused_args) { |
| 376 SendAllDisplayInfo(); | 379 SendAllDisplayInfo(); |
| 377 } | 380 } |
| 378 | 381 |
| 379 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { | 382 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { |
| 380 DCHECK(!args->empty()); | 383 DCHECK(!args->empty()); |
| 381 bool is_mirroring = false; | 384 bool is_mirroring = false; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 bool enable = false; | 553 bool enable = false; |
| 551 if (!args->GetBoolean(0, &enable)) | 554 if (!args->GetBoolean(0, &enable)) |
| 552 NOTREACHED(); | 555 NOTREACHED(); |
| 553 | 556 |
| 554 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 557 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
| 555 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); | 558 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); |
| 556 } | 559 } |
| 557 | 560 |
| 558 } // namespace options | 561 } // namespace options |
| 559 } // namespace chromeos | 562 } // namespace chromeos |
| OLD | NEW |