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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 UpdateDisplaySectionVisibility(); | 77 UpdateDisplaySectionVisibility(); |
78 SendDisplayInfo(); | 78 SendDisplayInfo(); |
79 } | 79 } |
80 | 80 |
81 void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) { | 81 void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) { |
82 UpdateDisplaySectionVisibility(); | 82 UpdateDisplaySectionVisibility(); |
83 SendDisplayInfo(); | 83 SendDisplayInfo(); |
84 } | 84 } |
85 | 85 |
86 void DisplayOptionsHandler::UpdateDisplaySectionVisibility() { | 86 void DisplayOptionsHandler::UpdateDisplaySectionVisibility() { |
87 aura::DisplayManager* display_manager = | |
88 aura::Env::GetInstance()->display_manager(); | |
89 chromeos::OutputState output_state = | 87 chromeos::OutputState output_state = |
90 ash::Shell::GetInstance()->output_configurator()->output_state(); | 88 ash::Shell::GetInstance()->output_configurator()->output_state(); |
91 base::FundamentalValue show_options( | 89 base::FundamentalValue show_options( |
92 DisplayController::IsExtendedDesktopEnabled() && | 90 DisplayController::IsExtendedDesktopEnabled() && |
93 display_manager->GetNumDisplays() > 1 && | |
94 output_state != chromeos::STATE_INVALID && | 91 output_state != chromeos::STATE_INVALID && |
95 output_state != chromeos::STATE_HEADLESS && | 92 output_state != chromeos::STATE_HEADLESS && |
96 output_state != chromeos::STATE_SINGLE); | 93 output_state != chromeos::STATE_SINGLE); |
97 web_ui()->CallJavascriptFunction( | 94 web_ui()->CallJavascriptFunction( |
98 "options.BrowserOptions.showDisplayOptions", show_options); | 95 "options.BrowserOptions.showDisplayOptions", show_options); |
99 } | 96 } |
100 | 97 |
101 void DisplayOptionsHandler::SendDisplayInfo() { | 98 void DisplayOptionsHandler::SendDisplayInfo() { |
102 aura::DisplayManager* display_manager = | 99 aura::DisplayManager* display_manager = |
103 aura::Env::GetInstance()->display_manager(); | 100 aura::Env::GetInstance()->display_manager(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 DCHECK_LE(DisplayController::TOP, layout); | 151 DCHECK_LE(DisplayController::TOP, layout); |
155 DCHECK_GE(DisplayController::LEFT, layout); | 152 DCHECK_GE(DisplayController::LEFT, layout); |
156 | 153 |
157 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 154 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
158 pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout); | 155 pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout); |
159 SendDisplayInfo(); | 156 SendDisplayInfo(); |
160 } | 157 } |
161 | 158 |
162 } // namespace options2 | 159 } // namespace options2 |
163 } // namespace chromeos | 160 } // namespace chromeos |
OLD | NEW |