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

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

Issue 562413002: Adds (native) annotation to the display settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 if (!GetFloat(dict, "deviceScaleFactor", &mode->device_scale_factor)) { 117 if (!GetFloat(dict, "deviceScaleFactor", &mode->device_scale_factor)) {
118 LOG(ERROR) << "missing deviceScaleFactor."; 118 LOG(ERROR) << "missing deviceScaleFactor.";
119 return false; 119 return false;
120 } 120 }
121 return true; 121 return true;
122 } 122 }
123 123
124 base::DictionaryValue* ConvertDisplayModeToValue(int64 display_id, 124 base::DictionaryValue* ConvertDisplayModeToValue(int64 display_id,
125 const ash::DisplayMode& mode) { 125 const ash::DisplayMode& mode) {
126 bool is_internal = GetDisplayManager()->IsInternalDisplayId(display_id);
126 base::DictionaryValue* result = new base::DictionaryValue(); 127 base::DictionaryValue* result = new base::DictionaryValue();
127 gfx::Size size_dip = mode.GetSizeInDIP(); 128 gfx::Size size_dip = mode.GetSizeInDIP();
128 result->SetInteger("width", size_dip.width()); 129 result->SetInteger("width", size_dip.width());
129 result->SetInteger("height", size_dip.height()); 130 result->SetInteger("height", size_dip.height());
130 result->SetInteger("originalWidth", mode.size.width()); 131 result->SetInteger("originalWidth", mode.size.width());
131 result->SetInteger("originalHeight", mode.size.height()); 132 result->SetInteger("originalHeight", mode.size.height());
132 result->SetDouble("deviceScaleFactor", mode.device_scale_factor); 133 result->SetDouble("deviceScaleFactor", mode.device_scale_factor);
133 result->SetDouble("scale", mode.ui_scale); 134 result->SetDouble("scale", mode.ui_scale);
134 result->SetDouble("refreshRate", mode.refresh_rate); 135 result->SetDouble("refreshRate", mode.refresh_rate);
135 result->SetBoolean("isBest", mode.native); 136 result->SetBoolean(
137 "isBest", is_internal ? (mode.ui_scale == 1.0f) : mode.native);
138 result->SetBoolean("isNative", mode.native);
136 result->SetBoolean( 139 result->SetBoolean(
137 "selected", mode.IsEquivalent( 140 "selected", mode.IsEquivalent(
138 GetDisplayManager()->GetActiveModeForDisplayId(display_id))); 141 GetDisplayManager()->GetActiveModeForDisplayId(display_id)));
139 return result; 142 return result;
140 } 143 }
141 144
142 } // namespace 145 } // namespace
143 146
144 DisplayOptionsHandler::DisplayOptionsHandler() { 147 DisplayOptionsHandler::DisplayOptionsHandler() {
145 ash::Shell::GetInstance()->display_controller()->AddObserver(this); 148 ash::Shell::GetInstance()->display_controller()->AddObserver(this);
(...skipping 25 matching lines...) Expand all
171 localized_strings->SetString("startMirroring", l10n_util::GetStringUTF16( 174 localized_strings->SetString("startMirroring", l10n_util::GetStringUTF16(
172 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_MIRRORING)); 175 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_MIRRORING));
173 localized_strings->SetString("stopMirroring", l10n_util::GetStringUTF16( 176 localized_strings->SetString("stopMirroring", l10n_util::GetStringUTF16(
174 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_STOP_MIRRORING)); 177 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_STOP_MIRRORING));
175 localized_strings->SetString("mirroringDisplay", l10n_util::GetStringUTF16( 178 localized_strings->SetString("mirroringDisplay", l10n_util::GetStringUTF16(
176 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_MIRRORING_DISPLAY_NAME)); 179 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_MIRRORING_DISPLAY_NAME));
177 localized_strings->SetString("setPrimary", l10n_util::GetStringUTF16( 180 localized_strings->SetString("setPrimary", l10n_util::GetStringUTF16(
178 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_SET_PRIMARY)); 181 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_SET_PRIMARY));
179 localized_strings->SetString("annotateBest", l10n_util::GetStringUTF16( 182 localized_strings->SetString("annotateBest", l10n_util::GetStringUTF16(
180 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_RESOLUTION_ANNOTATION_BEST)); 183 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_RESOLUTION_ANNOTATION_BEST));
184 localized_strings->SetString("annotateNative", l10n_util::GetStringUTF16(
185 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_RESOLUTION_ANNOTATION_NATIVE));
181 localized_strings->SetString("orientation0", l10n_util::GetStringUTF16( 186 localized_strings->SetString("orientation0", l10n_util::GetStringUTF16(
182 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_STANDARD_ORIENTATION)); 187 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_STANDARD_ORIENTATION));
183 localized_strings->SetString("orientation90", l10n_util::GetStringUTF16( 188 localized_strings->SetString("orientation90", l10n_util::GetStringUTF16(
184 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)); 189 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90));
185 localized_strings->SetString("orientation180", l10n_util::GetStringUTF16( 190 localized_strings->SetString("orientation180", l10n_util::GetStringUTF16(
186 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180)); 191 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180));
187 localized_strings->SetString("orientation270", l10n_util::GetStringUTF16( 192 localized_strings->SetString("orientation270", l10n_util::GetStringUTF16(
188 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270)); 193 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270));
189 localized_strings->SetString( 194 localized_strings->SetString(
190 "startCalibratingOverscan", l10n_util::GetStringUTF16( 195 "startCalibratingOverscan", l10n_util::GetStringUTF16(
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return; 455 return;
451 } 456 }
452 457
453 GetDisplayManager()->SetColorCalibrationProfile( 458 GetDisplayManager()->SetColorCalibrationProfile(
454 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); 459 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id));
455 SendAllDisplayInfo(); 460 SendAllDisplayInfo();
456 } 461 }
457 462
458 } // namespace options 463 } // namespace options
459 } // namespace chromeos 464 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698