| 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 <memory> | 10 #include <memory> |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) | 310 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) |
| 311 displays.push_back(display_manager->GetDisplayAt(i)); | 311 displays.push_back(display_manager->GetDisplayAt(i)); |
| 312 | 312 |
| 313 display::DisplayManager::MultiDisplayMode display_mode; | 313 display::DisplayManager::MultiDisplayMode display_mode; |
| 314 if (display_manager->IsInMirrorMode()) | 314 if (display_manager->IsInMirrorMode()) |
| 315 display_mode = display::DisplayManager::MIRRORING; | 315 display_mode = display::DisplayManager::MIRRORING; |
| 316 else if (display_manager->IsInUnifiedMode()) | 316 else if (display_manager->IsInUnifiedMode()) |
| 317 display_mode = display::DisplayManager::UNIFIED; | 317 display_mode = display::DisplayManager::UNIFIED; |
| 318 else | 318 else |
| 319 display_mode = display::DisplayManager::EXTENDED; | 319 display_mode = display::DisplayManager::EXTENDED; |
| 320 base::FundamentalValue mode(static_cast<int>(display_mode)); | 320 base::Value mode(static_cast<int>(display_mode)); |
| 321 | 321 |
| 322 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 322 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 323 std::unique_ptr<base::ListValue> js_displays(new base::ListValue); | 323 std::unique_ptr<base::ListValue> js_displays(new base::ListValue); |
| 324 for (const display::Display& display : displays) { | 324 for (const display::Display& display : displays) { |
| 325 const display::ManagedDisplayInfo& display_info = | 325 const display::ManagedDisplayInfo& display_info = |
| 326 display_manager->GetDisplayInfo(display.id()); | 326 display_manager->GetDisplayInfo(display.id()); |
| 327 auto js_display = base::MakeUnique<base::DictionaryValue>(); | 327 auto js_display = base::MakeUnique<base::DictionaryValue>(); |
| 328 js_display->SetString("id", base::Int64ToString(display.id())); | 328 js_display->SetString("id", base::Int64ToString(display.id())); |
| 329 js_display->SetString("name", | 329 js_display->SetString("name", |
| 330 display_manager->GetDisplayNameForId(display.id())); | 330 display_manager->GetDisplayNameForId(display.id())); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 bool disable_multi_display_layout = | 384 bool disable_multi_display_layout = |
| 385 base::CommandLine::ForCurrentProcess()->HasSwitch( | 385 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 386 chromeos::switches::kDisableMultiDisplayLayout); | 386 chromeos::switches::kDisableMultiDisplayLayout); |
| 387 bool ui_enabled = display_manager->num_connected_displays() <= 2 || | 387 bool ui_enabled = display_manager->num_connected_displays() <= 2 || |
| 388 !disable_multi_display_layout; | 388 !disable_multi_display_layout; |
| 389 bool unified_enabled = display_manager->unified_desktop_enabled(); | 389 bool unified_enabled = display_manager->unified_desktop_enabled(); |
| 390 bool mirrored_enabled = display_manager->num_connected_displays() == 2; | 390 bool mirrored_enabled = display_manager->num_connected_displays() == 2; |
| 391 | 391 |
| 392 web_ui()->CallJavascriptFunctionUnsafe( | 392 web_ui()->CallJavascriptFunctionUnsafe( |
| 393 "options.BrowserOptions.enableDisplaySettings", | 393 "options.BrowserOptions.enableDisplaySettings", |
| 394 base::FundamentalValue(ui_enabled), | 394 base::Value(ui_enabled), |
| 395 base::FundamentalValue(unified_enabled), | 395 base::Value(unified_enabled), |
| 396 base::FundamentalValue(mirrored_enabled)); | 396 base::Value(mirrored_enabled)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void DisplayOptionsHandler::HandleDisplayInfo( | 399 void DisplayOptionsHandler::HandleDisplayInfo( |
| 400 const base::ListValue* unused_args) { | 400 const base::ListValue* unused_args) { |
| 401 SendAllDisplayInfo(); | 401 SendAllDisplayInfo(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { | 404 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { |
| 405 DCHECK(!args->empty()); | 405 DCHECK(!args->empty()); |
| 406 bool is_mirroring = false; | 406 bool is_mirroring = false; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 if (!args->GetBoolean(0, &enable)) | 578 if (!args->GetBoolean(0, &enable)) |
| 579 NOTREACHED(); | 579 NOTREACHED(); |
| 580 | 580 |
| 581 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 581 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
| 582 enable ? display::DisplayManager::UNIFIED | 582 enable ? display::DisplayManager::UNIFIED |
| 583 : display::DisplayManager::EXTENDED); | 583 : display::DisplayManager::EXTENDED); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace options | 586 } // namespace options |
| 587 } // namespace chromeos | 587 } // namespace chromeos |
| OLD | NEW |