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

Side by Side Diff: ash/system/chromeos/tray_display.cc

Issue 1071353003: Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 "ash/system/chromeos/tray_display.h" 5 #include "ash/system/chromeos/tray_display.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/content/display/screen_orientation_controller_chromeos.h" 9 #include "ash/content/display/screen_orientation_controller_chromeos.h"
10 #include "ash/display/display_controller.h" 10 #include "ash/display/display_controller.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (external_id == gfx::Display::kInvalidDisplayID) { 200 if (external_id == gfx::Display::kInvalidDisplayID) {
201 return l10n_util::GetStringUTF16( 201 return l10n_util::GetStringUTF16(
202 IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); 202 IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME);
203 } 203 }
204 204
205 // The external display name may have an annotation of "(width x height)" in 205 // The external display name may have an annotation of "(width x height)" in
206 // case that the display is rotated or its resolution is changed. 206 // case that the display is rotated or its resolution is changed.
207 base::string16 name = GetDisplayName(external_id); 207 base::string16 name = GetDisplayName(external_id);
208 const DisplayInfo& display_info = 208 const DisplayInfo& display_info =
209 display_manager->GetDisplayInfo(external_id); 209 display_manager->GetDisplayInfo(external_id);
210 if (display_info.rotation() != gfx::Display::ROTATE_0 || 210 if (display_info.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE) !=
211 gfx::Display::ROTATE_0 ||
211 display_info.configured_ui_scale() != 1.0f || 212 display_info.configured_ui_scale() != 1.0f ||
212 !display_info.overscan_insets_in_dip().empty()) { 213 !display_info.overscan_insets_in_dip().empty()) {
213 name = l10n_util::GetStringFUTF16( 214 name = l10n_util::GetStringFUTF16(
214 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, 215 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME,
215 name, GetDisplaySize(external_id)); 216 name, GetDisplaySize(external_id));
216 } else if (display_info.overscan_insets_in_dip().empty() && 217 } else if (display_info.overscan_insets_in_dip().empty() &&
217 display_info.has_overscan()) { 218 display_info.has_overscan()) {
218 name = l10n_util::GetStringFUTF16( 219 name = l10n_util::GetStringFUTF16(
219 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, 220 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME,
220 name, l10n_util::GetStringUTF16( 221 name, l10n_util::GetStringUTF16(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); 257 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED);
257 } 258 }
258 259
259 return base::string16(); 260 return base::string16();
260 } 261 }
261 262
262 private: 263 private:
263 bool ShouldShowFirstDisplayInfo() const { 264 bool ShouldShowFirstDisplayInfo() const {
264 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( 265 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(
265 GetDisplayManager()->first_display_id()); 266 GetDisplayManager()->first_display_id());
266 return display_info.rotation() != gfx::Display::ROTATE_0 || 267 return display_info.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE) !=
267 display_info.configured_ui_scale() != 1.0f || 268 gfx::Display::ROTATE_0 ||
268 !display_info.overscan_insets_in_dip().empty() || 269 display_info.configured_ui_scale() != 1.0f ||
269 display_info.has_overscan(); 270 !display_info.overscan_insets_in_dip().empty() ||
271 display_info.has_overscan();
270 } 272 }
271 273
272 // Overridden from ActionableView. 274 // Overridden from ActionableView.
273 bool PerformAction(const ui::Event& event) override { 275 bool PerformAction(const ui::Event& event) override {
274 OpenSettings(); 276 OpenSettings();
275 return true; 277 return true;
276 } 278 }
277 279
278 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { 280 void OnBoundsChanged(const gfx::Rect& previous_bounds) override {
279 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - 281 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 -
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 335 }
334 336
335 if (iter->second.configured_ui_scale() != 337 if (iter->second.configured_ui_scale() !=
336 old_iter->second.configured_ui_scale()) { 338 old_iter->second.configured_ui_scale()) {
337 *message_out = l10n_util::GetStringFUTF16( 339 *message_out = l10n_util::GetStringFUTF16(
338 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, 340 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
339 GetDisplayName(iter->first), 341 GetDisplayName(iter->first),
340 GetDisplaySize(iter->first)); 342 GetDisplaySize(iter->first));
341 return true; 343 return true;
342 } 344 }
343 if (iter->second.rotation() != old_iter->second.rotation()) { 345 if (iter->second.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE) !=
346 old_iter->second.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE)) {
344 int rotation_text_id = 0; 347 int rotation_text_id = 0;
345 switch (iter->second.rotation()) { 348 switch (iter->second.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE)) {
346 case gfx::Display::ROTATE_0: 349 case gfx::Display::ROTATE_0:
347 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; 350 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION;
348 break; 351 break;
349 case gfx::Display::ROTATE_90: 352 case gfx::Display::ROTATE_90:
350 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; 353 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90;
351 break; 354 break;
352 case gfx::Display::ROTATE_180: 355 case gfx::Display::ROTATE_180:
353 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; 356 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180;
354 break; 357 break;
355 case gfx::Display::ROTATE_270: 358 case gfx::Display::ROTATE_270:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { 446 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) {
444 views::View* view = default_; 447 views::View* view = default_;
445 if (view) { 448 if (view) {
446 view->GetAccessibleState(state); 449 view->GetAccessibleState(state);
447 return true; 450 return true;
448 } 451 }
449 return false; 452 return false;
450 } 453 }
451 454
452 } // namespace ash 455 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698