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

Unified Diff: ash/system/chromeos/tray_display.cc

Issue 11369042: Caches the display names in MultiDisplayManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..e705038e0d150dde9b64659e8a17b072b2f95e14 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,18 +60,12 @@ 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) {
+ std::vector<std::string> display_names =
+ display_manager->GetExternalDisplayNames();
+ if (!display_names.empty()) {
label_->SetText(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING,
- UTF8ToUTF16(display_names[1])));
+ UTF8ToUTF16(display_names[0])));
SetVisible(true);
} else {
SetVisible(false);
oshima 2012/11/02 06:33:56 This state shouldn't happen, but if we ever failed
Jun Mukai 2012/11/02 16:09:07 Done.
@@ -80,8 +74,6 @@ class DisplayView : public ash::internal::ActionableView {
}
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,
« ash/display/multi_display_manager.cc ('K') | « ash/display/multi_display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698