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 <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 130 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
131 const gfx::Display* display = display_manager->GetDisplayAt(i); | 131 const gfx::Display* display = display_manager->GetDisplayAt(i); |
132 if (display->id() != old_display.id()) | 132 if (display->id() != old_display.id()) |
133 displays.push_back(display); | 133 displays.push_back(display); |
134 } | 134 } |
135 SendDisplayInfo(displays); | 135 SendDisplayInfo(displays); |
136 } | 136 } |
137 | 137 |
138 void DisplayOptionsHandler::UpdateDisplaySectionVisibility( | 138 void DisplayOptionsHandler::UpdateDisplaySectionVisibility( |
139 size_t num_displays) { | 139 size_t num_displays) { |
| 140 DisplayManager* display_manager = GetDisplayManager(); |
| 141 size_t min_displays_to_show = display_manager->HasInternalDisplay() ? 2 : 1; |
| 142 |
140 chromeos::OutputState output_state = | 143 chromeos::OutputState output_state = |
141 ash::Shell::GetInstance()->output_configurator()->output_state(); | 144 ash::Shell::GetInstance()->output_configurator()->output_state(); |
142 base::FundamentalValue show_options( | 145 base::FundamentalValue show_options( |
143 num_displays > 1 || output_state == chromeos::STATE_DUAL_MIRROR); | 146 num_displays >= min_displays_to_show || |
| 147 output_state == chromeos::STATE_DUAL_MIRROR); |
144 web_ui()->CallJavascriptFunction( | 148 web_ui()->CallJavascriptFunction( |
145 "options.BrowserOptions.showDisplayOptions", show_options); | 149 "options.BrowserOptions.showDisplayOptions", show_options); |
146 } | 150 } |
147 | 151 |
148 void DisplayOptionsHandler::SendAllDisplayInfo() { | 152 void DisplayOptionsHandler::SendAllDisplayInfo() { |
149 DisplayManager* display_manager = GetDisplayManager(); | 153 DisplayManager* display_manager = GetDisplayManager(); |
150 | 154 |
151 std::vector<const gfx::Display*> displays; | 155 std::vector<const gfx::Display*> displays; |
152 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 156 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
153 displays.push_back(display_manager->GetDisplayAt(i)); | 157 displays.push_back(display_manager->GetDisplayAt(i)); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 !args->GetDouble(2, &bottom) || !args->GetDouble(3, &right)) { | 338 !args->GetDouble(2, &bottom) || !args->GetDouble(3, &right)) { |
335 LOG(ERROR) << "Can't find overscan insets data."; | 339 LOG(ERROR) << "Can't find overscan insets data."; |
336 return; | 340 return; |
337 } | 341 } |
338 | 342 |
339 overscan_calibrator_->UpdateInsets(gfx::Insets(top, left, bottom, right)); | 343 overscan_calibrator_->UpdateInsets(gfx::Insets(top, left, bottom, right)); |
340 } | 344 } |
341 | 345 |
342 } // namespace options | 346 } // namespace options |
343 } // namespace chromeos | 347 } // namespace chromeos |
OLD | NEW |