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

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

Issue 12088081: Allows to show display settings for 1-display of stumpy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/display_options_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
index 00ad41e8775183ec68678194b5ff3a671ffd3aea..c39b6faad1cb48ed889f62165ef101204de9b0a9 100644
--- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
@@ -75,7 +75,12 @@ void DisplayOptionsHandler::GetLocalizedValues(
void DisplayOptionsHandler::InitializePage() {
DCHECK(web_ui());
- UpdateDisplaySectionVisibility(GetDisplayManager()->GetNumDisplays());
+ std::vector<const gfx::Display*> displays;
+ DisplayManager* display_manager = GetDisplayManager();
+ for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
+ displays.push_back(display_manager->GetDisplayAt(i));
+ }
+ UpdateDisplaySectionVisibility(displays);
}
void DisplayOptionsHandler::RegisterMessages() {
@@ -118,13 +123,17 @@ void DisplayOptionsHandler::OnDisplayBoundsChanged(
}
void DisplayOptionsHandler::OnDisplayAdded(const gfx::Display& new_display) {
- UpdateDisplaySectionVisibility(GetDisplayManager()->GetNumDisplays());
+ std::vector<const gfx::Display*> displays;
+ DisplayManager* display_manager = GetDisplayManager();
+ for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
+ displays.push_back(display_manager->GetDisplayAt(i));
+ }
+ UpdateDisplaySectionVisibility(displays);
SendAllDisplayInfo();
}
void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) {
DisplayManager* display_manager = GetDisplayManager();
- UpdateDisplaySectionVisibility(display_manager->GetNumDisplays() - 1);
std::vector<const gfx::Display*> displays;
for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
@@ -132,15 +141,25 @@ void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) {
if (display->id() != old_display.id())
displays.push_back(display);
}
+ UpdateDisplaySectionVisibility(displays);
SendDisplayInfo(displays);
}
void DisplayOptionsHandler::UpdateDisplaySectionVisibility(
- size_t num_displays) {
+ const std::vector<const gfx::Display*>& displays) {
+ DisplayManager* display_manager = GetDisplayManager();
+ bool has_external = false;
+ for (size_t i = 0; i < displays.size(); i++) {
+ if (!display_manager->IsInternalDisplayId(displays[i]->id())) {
+ has_external = true;
+ break;
+ }
+ }
oshima 2013/01/31 02:32:40 You should be able to tell if there is an external
Jun Mukai 2013/01/31 02:40:10 indeed. done.
+
chromeos::OutputState output_state =
ash::Shell::GetInstance()->output_configurator()->output_state();
base::FundamentalValue show_options(
- num_displays > 1 || output_state == chromeos::STATE_DUAL_MIRROR);
+ has_external || output_state == chromeos::STATE_DUAL_MIRROR);
web_ui()->CallJavascriptFunction(
"options.BrowserOptions.showDisplayOptions", show_options);
}
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/display_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698