| 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 "ash/system/chromeos/tray_display.h" | 5 #include "ash/system/chromeos/tray_display.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (mirroring) | 63 if (mirroring) |
| 64 return base::string16(); | 64 return base::string16(); |
| 65 | 65 |
| 66 DCHECK(display->is_valid()); | 66 DCHECK(display->is_valid()); |
| 67 return base::UTF8ToUTF16(display->size().ToString()); | 67 return base::UTF8ToUTF16(display->size().ToString()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Returns 1-line information for the specified display, like | 70 // Returns 1-line information for the specified display, like |
| 71 // "InternalDisplay: 1280x750" | 71 // "InternalDisplay: 1280x750" |
| 72 base::string16 GetDisplayInfoLine(int64_t display_id) { | 72 base::string16 GetDisplayInfoLine(int64_t display_id) { |
| 73 const DisplayInfo& display_info = | 73 const display::ManagedDisplayInfo& display_info = |
| 74 GetDisplayManager()->GetDisplayInfo(display_id); | 74 GetDisplayManager()->GetDisplayInfo(display_id); |
| 75 if (GetDisplayManager()->mirroring_display_id() == display_id) | 75 if (GetDisplayManager()->mirroring_display_id() == display_id) |
| 76 return GetDisplayName(display_id); | 76 return GetDisplayName(display_id); |
| 77 | 77 |
| 78 base::string16 size_text = GetDisplaySize(display_id); | 78 base::string16 size_text = GetDisplaySize(display_id); |
| 79 base::string16 display_data; | 79 base::string16 display_data; |
| 80 if (display_info.has_overscan()) { | 80 if (display_info.has_overscan()) { |
| 81 display_data = l10n_util::GetStringFUTF16( | 81 display_data = l10n_util::GetStringFUTF16( |
| 82 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATION, size_text, | 82 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATION, size_text, |
| 83 l10n_util::GetStringUTF16( | 83 l10n_util::GetStringUTF16( |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 if (external_id == display::Display::kInvalidDisplayID) { | 217 if (external_id == display::Display::kInvalidDisplayID) { |
| 218 return l10n_util::GetStringUTF16( | 218 return l10n_util::GetStringUTF16( |
| 219 IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 219 IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
| 220 } | 220 } |
| 221 | 221 |
| 222 // The external display name may have an annotation of "(width x height)" in | 222 // The external display name may have an annotation of "(width x height)" in |
| 223 // case that the display is rotated or its resolution is changed. | 223 // case that the display is rotated or its resolution is changed. |
| 224 base::string16 name = GetDisplayName(external_id); | 224 base::string16 name = GetDisplayName(external_id); |
| 225 const DisplayInfo& display_info = | 225 const display::ManagedDisplayInfo& display_info = |
| 226 display_manager->GetDisplayInfo(external_id); | 226 display_manager->GetDisplayInfo(external_id); |
| 227 if (display_info.GetActiveRotation() != display::Display::ROTATE_0 || | 227 if (display_info.GetActiveRotation() != display::Display::ROTATE_0 || |
| 228 display_info.configured_ui_scale() != 1.0f || | 228 display_info.configured_ui_scale() != 1.0f || |
| 229 !display_info.overscan_insets_in_dip().IsEmpty()) { | 229 !display_info.overscan_insets_in_dip().IsEmpty()) { |
| 230 name = | 230 name = |
| 231 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, | 231 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, |
| 232 name, GetDisplaySize(external_id)); | 232 name, GetDisplaySize(external_id)); |
| 233 } else if (display_info.overscan_insets_in_dip().IsEmpty() && | 233 } else if (display_info.overscan_insets_in_dip().IsEmpty() && |
| 234 display_info.has_overscan()) { | 234 display_info.has_overscan()) { |
| 235 name = l10n_util::GetStringFUTF16( | 235 name = l10n_util::GetStringFUTF16( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); | 276 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); |
| 277 } | 277 } |
| 278 | 278 |
| 279 return base::string16(); | 279 return base::string16(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 private: | 282 private: |
| 283 bool ShouldShowFirstDisplayInfo() const { | 283 bool ShouldShowFirstDisplayInfo() const { |
| 284 const int64_t first_display_id = GetDisplayManager()->first_display_id(); | 284 const int64_t first_display_id = GetDisplayManager()->first_display_id(); |
| 285 | 285 |
| 286 const DisplayInfo& display_info = | 286 const display::ManagedDisplayInfo& display_info = |
| 287 GetDisplayManager()->GetDisplayInfo(first_display_id); | 287 GetDisplayManager()->GetDisplayInfo(first_display_id); |
| 288 return (display_info.GetActiveRotation() != display::Display::ROTATE_0 && | 288 return (display_info.GetActiveRotation() != display::Display::ROTATE_0 && |
| 289 (display_info.active_rotation_source() != | 289 (display_info.active_rotation_source() != |
| 290 display::Display::ROTATION_SOURCE_ACCELEROMETER || | 290 display::Display::ROTATION_SOURCE_ACCELEROMETER || |
| 291 !display::Display::IsInternalDisplayId(first_display_id))) || | 291 !display::Display::IsInternalDisplayId(first_display_id))) || |
| 292 display_info.configured_ui_scale() != 1.0f || | 292 display_info.configured_ui_scale() != 1.0f || |
| 293 !display_info.overscan_insets_in_dip().IsEmpty() || | 293 !display_info.overscan_insets_in_dip().IsEmpty() || |
| 294 display_info.has_overscan(); | 294 display_info.has_overscan(); |
| 295 } | 295 } |
| 296 | 296 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 473 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 474 views::View* view = default_; | 474 views::View* view = default_; |
| 475 if (view) { | 475 if (view) { |
| 476 view->GetAccessibleState(state); | 476 view->GetAccessibleState(state); |
| 477 return true; | 477 return true; |
| 478 } | 478 } |
| 479 return false; | 479 return false; |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace ash | 482 } // namespace ash |
| OLD | NEW |