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