Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 1261693004: Allow dynamic enabling/disabling of unified desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 7 #include <string>
8 8
9 #include "ash/ash_switches.h"
10 #include "ash/display/display_configurator_animation.h" 9 #include "ash/display/display_configurator_animation.h"
11 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
12 #include "ash/display/resolution_notification_controller.h" 11 #include "ash/display/resolution_notification_controller.h"
13 #include "ash/display/window_tree_host_manager.h" 12 #include "ash/display/window_tree_host_manager.h"
14 #include "ash/rotator/screen_rotation_animator.h" 13 #include "ash/rotator/screen_rotation_animator.h"
15 #include "ash/shell.h" 14 #include "ash/shell.h"
16 #include "base/bind.h" 15 #include "base/bind.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 offset_value.reset(new base::FundamentalValue(layout.offset)); 323 offset_value.reset(new base::FundamentalValue(layout.offset));
325 } 324 }
326 325
327 web_ui()->CallJavascriptFunction( 326 web_ui()->CallJavascriptFunction(
328 "options.DisplayOptions.setDisplayInfo", 327 "options.DisplayOptions.setDisplayInfo",
329 mode, js_displays, *layout_value.get(), *offset_value.get()); 328 mode, js_displays, *layout_value.get(), *offset_value.get());
330 } 329 }
331 330
332 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { 331 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() {
333 bool enabled = GetDisplayManager()->num_connected_displays() <= 2; 332 bool enabled = GetDisplayManager()->num_connected_displays() <= 2;
334 bool show_unified_desktop = ash::switches::UnifiedDesktopEnabled(); 333 bool show_unified_desktop = GetDisplayManager()->unified_desktop_enabled();
335 334
336 web_ui()->CallJavascriptFunction( 335 web_ui()->CallJavascriptFunction(
337 "options.BrowserOptions.enableDisplaySettings", 336 "options.BrowserOptions.enableDisplaySettings",
338 base::FundamentalValue(enabled), 337 base::FundamentalValue(enabled),
339 base::FundamentalValue(show_unified_desktop)); 338 base::FundamentalValue(show_unified_desktop));
340 } 339 }
341 340
342 void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) { 341 void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) {
343 ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring); 342 ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring);
344 // Not necessary to start fade-in animation. DisplayConfigurator will do that. 343 // Not necessary to start fade-in animation. DisplayConfigurator will do that.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return; 480 return;
482 } 481 }
483 482
484 GetDisplayManager()->SetColorCalibrationProfile( 483 GetDisplayManager()->SetColorCalibrationProfile(
485 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); 484 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id));
486 SendAllDisplayInfo(); 485 SendAllDisplayInfo();
487 } 486 }
488 487
489 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled( 488 void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled(
490 const base::ListValue* args) { 489 const base::ListValue* args) {
491 DCHECK(ash::switches::UnifiedDesktopEnabled()); 490 DCHECK(GetDisplayManager()->unified_desktop_enabled());
492 bool enable = false; 491 bool enable = false;
493 if (args->GetBoolean(0, &enable)) { 492 if (args->GetBoolean(0, &enable)) {
494 GetDisplayManager()->SetDefaultMultiDisplayMode( 493 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays(
495 enable ? DisplayManager::UNIFIED : DisplayManager::EXTENDED); 494 enable ? DisplayManager::UNIFIED : DisplayManager::EXTENDED);
496 GetDisplayManager()->ReconfigureDisplays(); 495 GetDisplayManager()->ReconfigureDisplays();
497 } 496 }
498 } 497 }
499 498
500 } // namespace options 499 } // namespace options
501 } // namespace chromeos 500 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698