| 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 <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 Loading... |
| 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.GetActiveRotation() != gfx::Display::ROTATE_0 || |
| 211 display_info.configured_ui_scale() != 1.0f || | 211 display_info.configured_ui_scale() != 1.0f || |
| 212 !display_info.overscan_insets_in_dip().empty()) { | 212 !display_info.overscan_insets_in_dip().empty()) { |
| 213 name = l10n_util::GetStringFUTF16( | 213 name = l10n_util::GetStringFUTF16( |
| 214 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, | 214 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, |
| 215 name, GetDisplaySize(external_id)); | 215 name, GetDisplaySize(external_id)); |
| 216 } else if (display_info.overscan_insets_in_dip().empty() && | 216 } else if (display_info.overscan_insets_in_dip().empty() && |
| 217 display_info.has_overscan()) { | 217 display_info.has_overscan()) { |
| 218 name = l10n_util::GetStringFUTF16( | 218 name = l10n_util::GetStringFUTF16( |
| 219 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, | 219 IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, |
| 220 name, l10n_util::GetStringUTF16( | 220 name, l10n_util::GetStringUTF16( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); | 256 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); |
| 257 } | 257 } |
| 258 | 258 |
| 259 return base::string16(); | 259 return base::string16(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 private: | 262 private: |
| 263 bool ShouldShowFirstDisplayInfo() const { | 263 bool ShouldShowFirstDisplayInfo() const { |
| 264 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( | 264 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( |
| 265 GetDisplayManager()->first_display_id()); | 265 GetDisplayManager()->first_display_id()); |
| 266 return display_info.rotation() != gfx::Display::ROTATE_0 || | 266 return display_info.GetActiveRotation() != gfx::Display::ROTATE_0 || |
| 267 display_info.configured_ui_scale() != 1.0f || | 267 display_info.configured_ui_scale() != 1.0f || |
| 268 !display_info.overscan_insets_in_dip().empty() || | 268 !display_info.overscan_insets_in_dip().empty() || |
| 269 display_info.has_overscan(); | 269 display_info.has_overscan(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 // Overridden from ActionableView. | 272 // Overridden from ActionableView. |
| 273 bool PerformAction(const ui::Event& event) override { | 273 bool PerformAction(const ui::Event& event) override { |
| 274 OpenSettings(); | 274 OpenSettings(); |
| 275 return true; | 275 return true; |
| 276 } | 276 } |
| 277 | 277 |
| 278 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { | 278 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { |
| 279 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - | 279 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 | 334 |
| 335 if (iter->second.configured_ui_scale() != | 335 if (iter->second.configured_ui_scale() != |
| 336 old_iter->second.configured_ui_scale()) { | 336 old_iter->second.configured_ui_scale()) { |
| 337 *message_out = l10n_util::GetStringFUTF16( | 337 *message_out = l10n_util::GetStringFUTF16( |
| 338 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, | 338 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, |
| 339 GetDisplayName(iter->first), | 339 GetDisplayName(iter->first), |
| 340 GetDisplaySize(iter->first)); | 340 GetDisplaySize(iter->first)); |
| 341 return true; | 341 return true; |
| 342 } | 342 } |
| 343 if (iter->second.rotation() != old_iter->second.rotation()) { | 343 if (iter->second.GetActiveRotation() != |
| 344 old_iter->second.GetActiveRotation()) { |
| 344 int rotation_text_id = 0; | 345 int rotation_text_id = 0; |
| 345 switch (iter->second.rotation()) { | 346 switch (iter->second.GetActiveRotation()) { |
| 346 case gfx::Display::ROTATE_0: | 347 case gfx::Display::ROTATE_0: |
| 347 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; | 348 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; |
| 348 break; | 349 break; |
| 349 case gfx::Display::ROTATE_90: | 350 case gfx::Display::ROTATE_90: |
| 350 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; | 351 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; |
| 351 break; | 352 break; |
| 352 case gfx::Display::ROTATE_180: | 353 case gfx::Display::ROTATE_180: |
| 353 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; | 354 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; |
| 354 break; | 355 break; |
| 355 case gfx::Display::ROTATE_270: | 356 case gfx::Display::ROTATE_270: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 444 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 444 views::View* view = default_; | 445 views::View* view = default_; |
| 445 if (view) { | 446 if (view) { |
| 446 view->GetAccessibleState(state); | 447 view->GetAccessibleState(state); |
| 447 return true; | 448 return true; |
| 448 } | 449 } |
| 449 return false; | 450 return false; |
| 450 } | 451 } |
| 451 | 452 |
| 452 } // namespace ash | 453 } // namespace ash |
| OLD | NEW |