Chromium Code Reviews| 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/options2/chromeos/display_options_handler.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/display_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 UpdateDisplaySectionVisibility(); | 74 UpdateDisplaySectionVisibility(); |
| 75 SendDisplayInfo(); | 75 SendDisplayInfo(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) { | 78 void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) { |
| 79 UpdateDisplaySectionVisibility(); | 79 UpdateDisplaySectionVisibility(); |
| 80 SendDisplayInfo(); | 80 SendDisplayInfo(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void DisplayOptionsHandler::UpdateDisplaySectionVisibility() { | 83 void DisplayOptionsHandler::UpdateDisplaySectionVisibility() { |
| 84 aura::DisplayManager* display_manager = | |
| 85 aura::Env::GetInstance()->display_manager(); | |
| 86 chromeos::State output_state = | 84 chromeos::State output_state = |
| 87 ash::Shell::GetInstance()->output_configurator()->output_state(); | 85 ash::Shell::GetInstance()->output_configurator()->output_state(); |
| 88 base::FundamentalValue show_options( | 86 base::FundamentalValue show_options( |
| 89 DisplayController::IsExtendedDesktopEnabled() && | 87 DisplayController::IsExtendedDesktopEnabled() && |
| 90 display_manager->GetNumDisplays() > 1 && | |
| 91 output_state != chromeos::STATE_INVALID && | 88 output_state != chromeos::STATE_INVALID && |
| 92 output_state != chromeos::STATE_HEADLESS && | 89 output_state != chromeos::STATE_HEADLESS && |
| 93 output_state != chromeos::STATE_SINGLE); | 90 output_state != chromeos::STATE_SINGLE); |
|
oshima
2012/07/25 07:53:41
I think it's easier to read/follow if you list val
Jun Mukai
2012/07/25 08:14:43
Are there no chances to add a new state even when
oshima
2012/07/25 13:03:37
Existing code can break when state enum changes to
Jun Mukai
2012/07/25 14:44:42
Can we do that in another CL? That doesn't sound
| |
| 94 web_ui()->CallJavascriptFunction( | 91 web_ui()->CallJavascriptFunction( |
| 95 "options.BrowserOptions.showDisplayOptions", show_options); | 92 "options.BrowserOptions.showDisplayOptions", show_options); |
| 96 } | 93 } |
| 97 | 94 |
| 98 void DisplayOptionsHandler::SendDisplayInfo() { | 95 void DisplayOptionsHandler::SendDisplayInfo() { |
| 99 aura::DisplayManager* display_manager = | 96 aura::DisplayManager* display_manager = |
| 100 aura::Env::GetInstance()->display_manager(); | 97 aura::Env::GetInstance()->display_manager(); |
| 101 chromeos::OutputConfigurator* output_configurator = | 98 chromeos::OutputConfigurator* output_configurator = |
| 102 ash::Shell::GetInstance()->output_configurator(); | 99 ash::Shell::GetInstance()->output_configurator(); |
| 103 base::FundamentalValue mirroring( | 100 base::FundamentalValue mirroring( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 DCHECK_LE(DisplayController::TOP, layout); | 149 DCHECK_LE(DisplayController::TOP, layout); |
| 153 DCHECK_GE(DisplayController::LEFT, layout); | 150 DCHECK_GE(DisplayController::LEFT, layout); |
| 154 | 151 |
| 155 ash::Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( | 152 ash::Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( |
| 156 static_cast<DisplayController::SecondaryDisplayLayout>(layout)); | 153 static_cast<DisplayController::SecondaryDisplayLayout>(layout)); |
| 157 SendDisplayInfo(); | 154 SendDisplayInfo(); |
| 158 } | 155 } |
| 159 | 156 |
| 160 } // namespace options2 | 157 } // namespace options2 |
| 161 } // namespace chromeos | 158 } // namespace chromeos |
| OLD | NEW |