Index: ash/system/chromeos/tray_display.cc |
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc |
index 0e672d1d5a663fa52b87bcba1d99952219b0f8a4..d3c66a7af32fd8a8270240abbf5a829f9cce4c68 100644 |
--- a/ash/system/chromeos/tray_display.cc |
+++ b/ash/system/chromeos/tray_display.cc |
@@ -5,6 +5,7 @@ |
#include "ash/system/chromeos/tray_display.h" |
#include "ash/display/display_controller.h" |
+#include "ash/display/multi_display_manager.h" |
#include "ash/screen_ash.h" |
#include "ash/shell.h" |
#include "ash/system/tray/system_tray.h" |
@@ -23,10 +24,6 @@ |
#include "ui/views/controls/label.h" |
#include "ui/views/layout/box_layout.h" |
-#if defined(USE_X11) |
-#include "ui/base/x/x11_util.h" |
-#endif |
- |
namespace ash { |
namespace internal { |
@@ -53,6 +50,9 @@ class DisplayView : public ash::internal::ActionableView { |
virtual ~DisplayView() {} |
void Update() { |
+ MultiDisplayManager* display_manager = static_cast<MultiDisplayManager*>( |
+ aura::Env::GetInstance()->display_manager()); |
+ |
switch (Shell::GetInstance()->output_configurator()->output_state()) { |
case chromeos::STATE_INVALID: |
case chromeos::STATE_HEADLESS: |
@@ -60,37 +60,25 @@ class DisplayView : public ash::internal::ActionableView { |
SetVisible(false); |
return; |
case chromeos::STATE_DUAL_MIRROR: { |
- // Simply assumes that the primary display appears first and the |
- // secondary display appears next in the list. |
- std::vector<std::string> display_names; |
-#if defined(USE_X11) |
- std::vector<XID> output_ids; |
- ui::GetOutputDeviceHandles(&output_ids); |
- display_names = ui::GetDisplayNames(output_ids); |
-#endif |
- if (display_names.size() > 1) { |
- label_->SetText(l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, |
- UTF8ToUTF16(display_names[1]))); |
- SetVisible(true); |
- } else { |
- SetVisible(false); |
- } |
+ std::vector<std::string> display_names = |
+ display_manager->GetExternalDisplayNames(); |
+ string16 display_name = (!display_names.empty()) ? |
+ UTF8ToUTF16(display_names[0]) : |
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
+ label_->SetText(l10n_util::GetStringFUTF16( |
+ IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, display_name)); |
+ SetVisible(true); |
return; |
} |
case chromeos::STATE_DUAL_PRIMARY_ONLY: |
case chromeos::STATE_DUAL_SECONDARY_ONLY: { |
- aura::DisplayManager* display_manager = |
- aura::Env::GetInstance()->display_manager(); |
- if (display_manager->GetNumDisplays() > 1) { |
- label_->SetText(l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, |
- UTF8ToUTF16(display_manager->GetDisplayNameFor( |
- ScreenAsh::GetSecondaryDisplay())))); |
- SetVisible(true); |
- } else { |
- SetVisible(false); |
- } |
+ string16 display_name = (display_manager->GetNumDisplays() > 1) ? |
+ UTF8ToUTF16(display_manager->GetDisplayNameFor( |
+ ScreenAsh::GetSecondaryDisplay())) : |
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
+ label_->SetText(l10n_util::GetStringFUTF16( |
+ IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, display_name)); |
+ SetVisible(true); |
return; |
} |
default: |