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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
357 web_ui()->CallJavascriptFunction("options.DisplayOptions.setDisplayInfo", | 357 web_ui()->CallJavascriptFunctionUnsafe( |
358 mode, *js_displays); | 358 "options.DisplayOptions.setDisplayInfo", mode, *js_displays); |
359 } | 359 } |
360 | 360 |
361 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { | 361 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { |
362 ash::DisplayManager* display_manager = GetDisplayManager(); | 362 ash::DisplayManager* display_manager = GetDisplayManager(); |
363 bool disable_multi_display_layout = | 363 bool disable_multi_display_layout = |
364 base::CommandLine::ForCurrentProcess()->HasSwitch( | 364 base::CommandLine::ForCurrentProcess()->HasSwitch( |
365 chromeos::switches::kDisableMultiDisplayLayout); | 365 chromeos::switches::kDisableMultiDisplayLayout); |
366 bool ui_enabled = display_manager->num_connected_displays() <= 2 || | 366 bool ui_enabled = display_manager->num_connected_displays() <= 2 || |
367 !disable_multi_display_layout; | 367 !disable_multi_display_layout; |
368 bool unified_enabled = display_manager->unified_desktop_enabled(); | 368 bool unified_enabled = display_manager->unified_desktop_enabled(); |
369 bool mirrored_enabled = display_manager->num_connected_displays() == 2; | 369 bool mirrored_enabled = display_manager->num_connected_displays() == 2; |
370 | 370 |
371 web_ui()->CallJavascriptFunction( | 371 web_ui()->CallJavascriptFunctionUnsafe( |
372 "options.BrowserOptions.enableDisplaySettings", | 372 "options.BrowserOptions.enableDisplaySettings", |
373 base::FundamentalValue(ui_enabled), | 373 base::FundamentalValue(ui_enabled), |
374 base::FundamentalValue(unified_enabled), | 374 base::FundamentalValue(unified_enabled), |
375 base::FundamentalValue(mirrored_enabled)); | 375 base::FundamentalValue(mirrored_enabled)); |
376 } | 376 } |
377 | 377 |
378 void DisplayOptionsHandler::HandleDisplayInfo( | 378 void DisplayOptionsHandler::HandleDisplayInfo( |
379 const base::ListValue* unused_args) { | 379 const base::ListValue* unused_args) { |
380 SendAllDisplayInfo(); | 380 SendAllDisplayInfo(); |
381 } | 381 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |