| 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/screen_layout_observer.h" | 5 #include "ash/system/chromeos/screen_layout_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "base/bind.h" | 22 #include "base/bind.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "grit/ash_resources.h" | 25 #include "grit/ash_resources.h" |
| 26 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/display/display.h" | 29 #include "ui/display/display.h" |
| 30 #include "ui/display/manager/display_manager.h" | 30 #include "ui/display/manager/display_manager.h" |
| 31 #include "ui/display/types/display_constants.h" |
| 31 #include "ui/message_center/message_center.h" | 32 #include "ui/message_center/message_center.h" |
| 32 #include "ui/message_center/notification.h" | 33 #include "ui/message_center/notification.h" |
| 33 #include "ui/message_center/notification_delegate.h" | 34 #include "ui/message_center/notification_delegate.h" |
| 34 | 35 |
| 35 using message_center::Notification; | 36 using message_center::Notification; |
| 36 | 37 |
| 37 namespace ash { | 38 namespace ash { |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 display::DisplayManager* GetDisplayManager() { | 41 display::DisplayManager* GetDisplayManager() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 UMA_STATUS_AREA_DISPLAY_NOTIFICATION_SHOW_SETTINGS); | 100 UMA_STATUS_AREA_DISPLAY_NOTIFICATION_SHOW_SETTINGS); |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 | 103 |
| 103 // Returns the name of the currently connected external display. This should not | 104 // Returns the name of the currently connected external display. This should not |
| 104 // be used when the external display is used for mirroring. | 105 // be used when the external display is used for mirroring. |
| 105 base::string16 GetExternalDisplayName() { | 106 base::string16 GetExternalDisplayName() { |
| 106 display::DisplayManager* display_manager = GetDisplayManager(); | 107 display::DisplayManager* display_manager = GetDisplayManager(); |
| 107 DCHECK(!display_manager->IsInMirrorMode()); | 108 DCHECK(!display_manager->IsInMirrorMode()); |
| 108 | 109 |
| 109 int64_t external_id = display::Display::kInvalidDisplayID; | 110 int64_t external_id = display::kInvalidDisplayId; |
| 110 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 111 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
| 111 int64_t id = display_manager->GetDisplayAt(i).id(); | 112 int64_t id = display_manager->GetDisplayAt(i).id(); |
| 112 if (!display::Display::IsInternalDisplayId(id)) { | 113 if (!display::Display::IsInternalDisplayId(id)) { |
| 113 external_id = id; | 114 external_id = id; |
| 114 break; | 115 break; |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 if (external_id == display::Display::kInvalidDisplayID) | 119 if (external_id == display::kInvalidDisplayId) |
| 119 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 120 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
| 120 | 121 |
| 121 // The external display name may have an annotation of "(width x height)" in | 122 // The external display name may have an annotation of "(width x height)" in |
| 122 // case that the display is rotated or its resolution is changed. | 123 // case that the display is rotated or its resolution is changed. |
| 123 base::string16 name = GetDisplayName(external_id); | 124 base::string16 name = GetDisplayName(external_id); |
| 124 const display::ManagedDisplayInfo& display_info = | 125 const display::ManagedDisplayInfo& display_info = |
| 125 display_manager->GetDisplayInfo(external_id); | 126 display_manager->GetDisplayInfo(external_id); |
| 126 if (display_info.GetActiveRotation() != display::Display::ROTATE_0 || | 127 if (display_info.GetActiveRotation() != display::Display::ROTATE_0 || |
| 127 display_info.configured_ui_scale() != 1.0f || | 128 display_info.configured_ui_scale() != 1.0f || |
| 128 !display_info.overscan_insets_in_dip().IsEmpty()) { | 129 !display_info.overscan_insets_in_dip().IsEmpty()) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (!show_notifications_for_testing) | 306 if (!show_notifications_for_testing) |
| 306 return; | 307 return; |
| 307 | 308 |
| 308 base::string16 message; | 309 base::string16 message; |
| 309 base::string16 additional_message; | 310 base::string16 additional_message; |
| 310 if (GetDisplayMessageForNotification(old_info, &message, &additional_message)) | 311 if (GetDisplayMessageForNotification(old_info, &message, &additional_message)) |
| 311 CreateOrUpdateNotification(message, additional_message); | 312 CreateOrUpdateNotification(message, additional_message); |
| 312 } | 313 } |
| 313 | 314 |
| 314 } // namespace ash | 315 } // namespace ash |
| OLD | NEW |