Chromium Code Reviews| 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 ash::Shell::GetInstance()->display_controller()->AddObserver(this); | 148 // ash::Shell doesn't exist in Athena. |
| 149 // See: http://crbug.com/416961 | |
| 150 if (ash::Shell::HasInstance()) | |
|
oshima
2014/09/23 20:48:21
can you use ifdef USE_ATHENA?
Jun Mukai
2014/09/23 20:52:38
Done.
| |
| 151 ash::Shell::GetInstance()->display_controller()->AddObserver(this); | |
| 149 } | 152 } |
| 150 | 153 |
| 151 DisplayOptionsHandler::~DisplayOptionsHandler() { | 154 DisplayOptionsHandler::~DisplayOptionsHandler() { |
| 152 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this); | 155 // ash::Shell doesn't exist in Athena. |
| 156 if (ash::Shell::HasInstance()) | |
| 157 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this); | |
| 153 } | 158 } |
| 154 | 159 |
| 155 void DisplayOptionsHandler::GetLocalizedValues( | 160 void DisplayOptionsHandler::GetLocalizedValues( |
| 156 base::DictionaryValue* localized_strings) { | 161 base::DictionaryValue* localized_strings) { |
| 157 DCHECK(localized_strings); | 162 DCHECK(localized_strings); |
| 158 RegisterTitle(localized_strings, "displayOptionsPage", | 163 RegisterTitle(localized_strings, "displayOptionsPage", |
| 159 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); | 164 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); |
| 160 | 165 |
| 161 localized_strings->SetString( | 166 localized_strings->SetString( |
| 162 "selectedDisplayTitleOptions", l10n_util::GetStringUTF16( | 167 "selectedDisplayTitleOptions", l10n_util::GetStringUTF16( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 localized_strings->SetString( | 199 localized_strings->SetString( |
| 195 "startCalibratingOverscan", l10n_util::GetStringUTF16( | 200 "startCalibratingOverscan", l10n_util::GetStringUTF16( |
| 196 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_CALIBRATING_OVERSCAN)); | 201 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_CALIBRATING_OVERSCAN)); |
| 197 localized_strings->SetString( | 202 localized_strings->SetString( |
| 198 "selectedDisplayColorProfile", l10n_util::GetStringUTF16( | 203 "selectedDisplayColorProfile", l10n_util::GetStringUTF16( |
| 199 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE)); | 204 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE)); |
| 200 } | 205 } |
| 201 | 206 |
| 202 void DisplayOptionsHandler::InitializePage() { | 207 void DisplayOptionsHandler::InitializePage() { |
| 203 DCHECK(web_ui()); | 208 DCHECK(web_ui()); |
| 209 web_ui()->CallJavascriptFunction( | |
| 210 "options.BrowserOptions.enableDisplayButton", | |
| 211 base::FundamentalValue(ash::Shell::HasInstance())); | |
|
oshima
2014/09/23 20:48:21
ditto
Jun Mukai
2014/09/23 20:52:38
Done.
| |
| 204 } | 212 } |
| 205 | 213 |
| 206 void DisplayOptionsHandler::RegisterMessages() { | 214 void DisplayOptionsHandler::RegisterMessages() { |
| 207 web_ui()->RegisterMessageCallback( | 215 web_ui()->RegisterMessageCallback( |
| 208 "getDisplayInfo", | 216 "getDisplayInfo", |
| 209 base::Bind(&DisplayOptionsHandler::HandleDisplayInfo, | 217 base::Bind(&DisplayOptionsHandler::HandleDisplayInfo, |
| 210 base::Unretained(this))); | 218 base::Unretained(this))); |
| 211 web_ui()->RegisterMessageCallback( | 219 web_ui()->RegisterMessageCallback( |
| 212 "setMirroring", | 220 "setMirroring", |
| 213 base::Bind(&DisplayOptionsHandler::HandleMirroring, | 221 base::Bind(&DisplayOptionsHandler::HandleMirroring, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 return; | 463 return; |
| 456 } | 464 } |
| 457 | 465 |
| 458 GetDisplayManager()->SetColorCalibrationProfile( | 466 GetDisplayManager()->SetColorCalibrationProfile( |
| 459 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 467 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
| 460 SendAllDisplayInfo(); | 468 SendAllDisplayInfo(); |
| 461 } | 469 } |
| 462 | 470 |
| 463 } // namespace options | 471 } // namespace options |
| 464 } // namespace chromeos | 472 } // namespace chromeos |
| OLD | NEW |