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

Side by Side Diff: ash/system/chromeos/tray_display.cc

Issue 13947019: Clean up selected ash defines for MessagePumpLinux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 7 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 label_ = new views::Label(); 51 label_ = new views::Label();
52 label_->SetMultiLine(true); 52 label_->SetMultiLine(true);
53 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 53 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
54 AddChildView(label_); 54 AddChildView(label_);
55 Update(); 55 Update();
56 } 56 }
57 57
58 virtual ~DisplayView() {} 58 virtual ~DisplayView() {}
59 59
60 void Update() { 60 void Update() {
61 #if !defined(USE_X11)
62 SetVisible(false);
63 #else
61 chromeos::OutputState state = 64 chromeos::OutputState state =
62 base::chromeos::IsRunningOnChromeOS() ? 65 base::chromeos::IsRunningOnChromeOS() ?
63 Shell::GetInstance()->output_configurator()->output_state() : 66 Shell::GetInstance()->output_configurator()->output_state() :
64 InferOutputState(); 67 InferOutputState();
65 switch (state) { 68 switch (state) {
66 case chromeos::STATE_INVALID: 69 case chromeos::STATE_INVALID:
67 case chromeos::STATE_HEADLESS: 70 case chromeos::STATE_HEADLESS:
68 case chromeos::STATE_SINGLE: 71 case chromeos::STATE_SINGLE:
69 SetVisible(false); 72 SetVisible(false);
70 return; 73 return;
71 case chromeos::STATE_DUAL_MIRROR: { 74 case chromeos::STATE_DUAL_MIRROR: {
72 label_->SetText(l10n_util::GetStringFUTF16( 75 label_->SetText(l10n_util::GetStringFUTF16(
73 IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, GetExternalDisplayName())); 76 IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, GetExternalDisplayName()));
74 SetVisible(true); 77 SetVisible(true);
75 return; 78 return;
76 } 79 }
77 case chromeos::STATE_DUAL_EXTENDED: 80 case chromeos::STATE_DUAL_EXTENDED:
78 case chromeos::STATE_DUAL_UNKNOWN: { 81 case chromeos::STATE_DUAL_UNKNOWN: {
79 label_->SetText(l10n_util::GetStringFUTF16( 82 label_->SetText(l10n_util::GetStringFUTF16(
80 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetExternalDisplayName())); 83 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetExternalDisplayName()));
81 SetVisible(true); 84 SetVisible(true);
82 return; 85 return;
83 } 86 }
84 default: 87 default:
85 NOTREACHED(); 88 NOTREACHED();
86 } 89 }
90 #endif
87 } 91 }
88 92
89 chromeos::OutputState InferOutputState() const { 93 chromeos::OutputState InferOutputState() const {
90 return Shell::GetScreen()->GetNumDisplays() == 1 ? 94 return Shell::GetScreen()->GetNumDisplays() == 1 ?
91 chromeos::STATE_SINGLE : chromeos::STATE_DUAL_EXTENDED; 95 chromeos::STATE_SINGLE : chromeos::STATE_DUAL_EXTENDED;
92 } 96 }
93 97
94 private: 98 private:
95 // Returns the name of the currently connected external display. 99 // Returns the name of the currently connected external display.
96 string16 GetExternalDisplayName() const { 100 string16 GetExternalDisplayName() const {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 views::ImageView* image_; 139 views::ImageView* image_;
136 views::Label* label_; 140 views::Label* label_;
137 141
138 DISALLOW_COPY_AND_ASSIGN(DisplayView); 142 DISALLOW_COPY_AND_ASSIGN(DisplayView);
139 }; 143 };
140 144
141 TrayDisplay::TrayDisplay(SystemTray* system_tray) 145 TrayDisplay::TrayDisplay(SystemTray* system_tray)
142 : SystemTrayItem(system_tray), 146 : SystemTrayItem(system_tray),
143 default_(NULL) { 147 default_(NULL) {
144 Shell::GetScreen()->AddObserver(this); 148 Shell::GetScreen()->AddObserver(this);
149 #if defined(USE_X11)
145 Shell::GetInstance()->output_configurator()->AddObserver(this); 150 Shell::GetInstance()->output_configurator()->AddObserver(this);
151 #endif
146 } 152 }
147 153
148 TrayDisplay::~TrayDisplay() { 154 TrayDisplay::~TrayDisplay() {
149 Shell::GetScreen()->RemoveObserver(this); 155 Shell::GetScreen()->RemoveObserver(this);
156 #if defined(USE_X11)
150 Shell::GetInstance()->output_configurator()->RemoveObserver(this); 157 Shell::GetInstance()->output_configurator()->RemoveObserver(this);
158 #endif
151 } 159 }
152 160
153 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { 161 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
154 default_ = new DisplayView(status); 162 default_ = new DisplayView(status);
155 return default_; 163 return default_;
156 } 164 }
157 165
158 void TrayDisplay::DestroyDefaultView() { 166 void TrayDisplay::DestroyDefaultView() {
159 default_ = NULL; 167 default_ = NULL;
160 } 168 }
(...skipping 15 matching lines...) Expand all
176 184
177 #if defined(OS_CHROMEOS) 185 #if defined(OS_CHROMEOS)
178 void TrayDisplay::OnDisplayModeChanged() { 186 void TrayDisplay::OnDisplayModeChanged() {
179 if (default_) 187 if (default_)
180 default_->Update(); 188 default_->Update();
181 } 189 }
182 #endif 190 #endif
183 191
184 } // namespace internal 192 } // namespace internal
185 } // namespace ash 193 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698