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

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

Issue 10824071: chromeos: output_configurator: various style fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/display/output_configurator.h » ('j') | 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/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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 87 aura::DisplayManager* display_manager =
88 aura::Env::GetInstance()->display_manager(); 88 aura::Env::GetInstance()->display_manager();
89 chromeos::State output_state = 89 chromeos::OutputState output_state =
90 ash::Shell::GetInstance()->output_configurator()->output_state(); 90 ash::Shell::GetInstance()->output_configurator()->output_state();
91 base::FundamentalValue show_options( 91 base::FundamentalValue show_options(
92 DisplayController::IsExtendedDesktopEnabled() && 92 DisplayController::IsExtendedDesktopEnabled() &&
93 display_manager->GetNumDisplays() > 1 && 93 display_manager->GetNumDisplays() > 1 &&
94 output_state != chromeos::STATE_INVALID && 94 output_state != chromeos::STATE_INVALID &&
95 output_state != chromeos::STATE_HEADLESS && 95 output_state != chromeos::STATE_HEADLESS &&
96 output_state != chromeos::STATE_SINGLE); 96 output_state != chromeos::STATE_SINGLE);
97 web_ui()->CallJavascriptFunction( 97 web_ui()->CallJavascriptFunction(
98 "options.BrowserOptions.showDisplayOptions", show_options); 98 "options.BrowserOptions.showDisplayOptions", show_options);
99 } 99 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const base::ListValue* unused_args) { 132 const base::ListValue* unused_args) {
133 SendDisplayInfo(); 133 SendDisplayInfo();
134 } 134 }
135 135
136 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { 136 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) {
137 DCHECK(!args->empty()); 137 DCHECK(!args->empty());
138 bool is_mirroring = false; 138 bool is_mirroring = false;
139 args->GetBoolean(0, &is_mirroring); 139 args->GetBoolean(0, &is_mirroring);
140 // We use 'PRIMARY_ONLY' for non-mirroring state for now. 140 // We use 'PRIMARY_ONLY' for non-mirroring state for now.
141 // TODO(mukai): fix this and support multiple display modes. 141 // TODO(mukai): fix this and support multiple display modes.
142 chromeos::State new_state = 142 chromeos::OutputState new_state =
143 is_mirroring ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY; 143 is_mirroring ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY;
144 ash::Shell::GetInstance()->output_configurator()->SetDisplayMode(new_state); 144 ash::Shell::GetInstance()->output_configurator()->SetDisplayMode(new_state);
145 SendDisplayInfo(); 145 SendDisplayInfo();
146 } 146 }
147 147
148 void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) { 148 void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) {
149 double layout = -1; 149 double layout = -1;
150 if (!args->GetDouble(0, &layout)) { 150 if (!args->GetDouble(0, &layout)) {
151 LOG(ERROR) << "Invalid parameter"; 151 LOG(ERROR) << "Invalid parameter";
152 return; 152 return;
153 } 153 }
154 DCHECK_LE(DisplayController::TOP, layout); 154 DCHECK_LE(DisplayController::TOP, layout);
155 DCHECK_GE(DisplayController::LEFT, layout); 155 DCHECK_GE(DisplayController::LEFT, layout);
156 156
157 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); 157 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
158 pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout); 158 pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout);
159 SendDisplayInfo(); 159 SendDisplayInfo();
160 } 160 }
161 161
162 } // namespace options2 162 } // namespace options2
163 } // namespace chromeos 163 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/display/output_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698