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_configurator_animation.h" | 9 #include "ash/display/display_configurator_animation.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 result->SetBoolean("isNative", mode.native); | 138 result->SetBoolean("isNative", mode.native); |
139 result->SetBoolean( | 139 result->SetBoolean( |
140 "selected", mode.IsEquivalent( | 140 "selected", mode.IsEquivalent( |
141 GetDisplayManager()->GetActiveModeForDisplayId(display_id))); | 141 GetDisplayManager()->GetActiveModeForDisplayId(display_id))); |
142 return result; | 142 return result; |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 DisplayOptionsHandler::DisplayOptionsHandler() { | 147 DisplayOptionsHandler::DisplayOptionsHandler() { |
| 148 #if !defined(USE_ATHENA) |
| 149 // ash::Shell doesn't exist in Athena. |
| 150 // See: http://crbug.com/416961 |
148 ash::Shell::GetInstance()->display_controller()->AddObserver(this); | 151 ash::Shell::GetInstance()->display_controller()->AddObserver(this); |
| 152 #endif |
149 } | 153 } |
150 | 154 |
151 DisplayOptionsHandler::~DisplayOptionsHandler() { | 155 DisplayOptionsHandler::~DisplayOptionsHandler() { |
| 156 #if !defined(USE_ATHENA) |
| 157 // ash::Shell doesn't exist in Athena. |
152 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this); | 158 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this); |
| 159 #endif |
153 } | 160 } |
154 | 161 |
155 void DisplayOptionsHandler::GetLocalizedValues( | 162 void DisplayOptionsHandler::GetLocalizedValues( |
156 base::DictionaryValue* localized_strings) { | 163 base::DictionaryValue* localized_strings) { |
157 DCHECK(localized_strings); | 164 DCHECK(localized_strings); |
158 RegisterTitle(localized_strings, "displayOptionsPage", | 165 RegisterTitle(localized_strings, "displayOptionsPage", |
159 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); | 166 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); |
160 | 167 |
161 localized_strings->SetString( | 168 localized_strings->SetString( |
162 "selectedDisplayTitleOptions", l10n_util::GetStringUTF16( | 169 "selectedDisplayTitleOptions", l10n_util::GetStringUTF16( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 localized_strings->SetString( | 201 localized_strings->SetString( |
195 "startCalibratingOverscan", l10n_util::GetStringUTF16( | 202 "startCalibratingOverscan", l10n_util::GetStringUTF16( |
196 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_CALIBRATING_OVERSCAN)); | 203 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_CALIBRATING_OVERSCAN)); |
197 localized_strings->SetString( | 204 localized_strings->SetString( |
198 "selectedDisplayColorProfile", l10n_util::GetStringUTF16( | 205 "selectedDisplayColorProfile", l10n_util::GetStringUTF16( |
199 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE)); | 206 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE)); |
200 } | 207 } |
201 | 208 |
202 void DisplayOptionsHandler::InitializePage() { | 209 void DisplayOptionsHandler::InitializePage() { |
203 DCHECK(web_ui()); | 210 DCHECK(web_ui()); |
| 211 #if !defined(USE_ATHENA) |
| 212 web_ui()->CallJavascriptFunction( |
| 213 "options.BrowserOptions.enableDisplayButton", |
| 214 base::FundamentalValue(true)); |
| 215 #endif |
204 } | 216 } |
205 | 217 |
206 void DisplayOptionsHandler::RegisterMessages() { | 218 void DisplayOptionsHandler::RegisterMessages() { |
207 web_ui()->RegisterMessageCallback( | 219 web_ui()->RegisterMessageCallback( |
208 "getDisplayInfo", | 220 "getDisplayInfo", |
209 base::Bind(&DisplayOptionsHandler::HandleDisplayInfo, | 221 base::Bind(&DisplayOptionsHandler::HandleDisplayInfo, |
210 base::Unretained(this))); | 222 base::Unretained(this))); |
211 web_ui()->RegisterMessageCallback( | 223 web_ui()->RegisterMessageCallback( |
212 "setMirroring", | 224 "setMirroring", |
213 base::Bind(&DisplayOptionsHandler::HandleMirroring, | 225 base::Bind(&DisplayOptionsHandler::HandleMirroring, |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return; | 467 return; |
456 } | 468 } |
457 | 469 |
458 GetDisplayManager()->SetColorCalibrationProfile( | 470 GetDisplayManager()->SetColorCalibrationProfile( |
459 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 471 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
460 SendAllDisplayInfo(); | 472 SendAllDisplayInfo(); |
461 } | 473 } |
462 | 474 |
463 } // namespace options | 475 } // namespace options |
464 } // namespace chromeos | 476 } // namespace chromeos |
OLD | NEW |