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

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: correctly fixed merge conflict Created 7 years, 7 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 case chromeos::STATE_DUAL_EXTENDED: 79 case chromeos::STATE_DUAL_EXTENDED:
77 label_->SetText(l10n_util::GetStringFUTF16( 80 label_->SetText(l10n_util::GetStringFUTF16(
78 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetExternalDisplayName())); 81 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetExternalDisplayName()));
79 SetVisible(true); 82 SetVisible(true);
80 return; 83 return;
81 } 84 }
82 NOTREACHED() << "Unhandled state " << state; 85 NOTREACHED() << "Unhandled state " << state;
86 #endif
83 } 87 }
84 88
85 chromeos::OutputState InferOutputState() const { 89 chromeos::OutputState InferOutputState() const {
86 return Shell::GetScreen()->GetNumDisplays() == 1 ? 90 return Shell::GetScreen()->GetNumDisplays() == 1 ?
87 chromeos::STATE_SINGLE : chromeos::STATE_DUAL_EXTENDED; 91 chromeos::STATE_SINGLE : chromeos::STATE_DUAL_EXTENDED;
88 } 92 }
89 93
90 private: 94 private:
91 // Returns the name of the currently connected external display. 95 // Returns the name of the currently connected external display.
92 base::string16 GetExternalDisplayName() const { 96 base::string16 GetExternalDisplayName() const {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 views::ImageView* image_; 135 views::ImageView* image_;
132 views::Label* label_; 136 views::Label* label_;
133 137
134 DISALLOW_COPY_AND_ASSIGN(DisplayView); 138 DISALLOW_COPY_AND_ASSIGN(DisplayView);
135 }; 139 };
136 140
137 TrayDisplay::TrayDisplay(SystemTray* system_tray) 141 TrayDisplay::TrayDisplay(SystemTray* system_tray)
138 : SystemTrayItem(system_tray), 142 : SystemTrayItem(system_tray),
139 default_(NULL) { 143 default_(NULL) {
140 Shell::GetScreen()->AddObserver(this); 144 Shell::GetScreen()->AddObserver(this);
145 #if defined(USE_X11)
141 Shell::GetInstance()->output_configurator()->AddObserver(this); 146 Shell::GetInstance()->output_configurator()->AddObserver(this);
147 #endif
142 } 148 }
143 149
144 TrayDisplay::~TrayDisplay() { 150 TrayDisplay::~TrayDisplay() {
145 Shell::GetScreen()->RemoveObserver(this); 151 Shell::GetScreen()->RemoveObserver(this);
152 #if defined(USE_X11)
146 Shell::GetInstance()->output_configurator()->RemoveObserver(this); 153 Shell::GetInstance()->output_configurator()->RemoveObserver(this);
154 #endif
147 } 155 }
148 156
149 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { 157 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
150 default_ = new DisplayView(status); 158 default_ = new DisplayView(status);
151 return default_; 159 return default_;
152 } 160 }
153 161
154 void TrayDisplay::DestroyDefaultView() { 162 void TrayDisplay::DestroyDefaultView() {
155 default_ = NULL; 163 default_ = NULL;
156 } 164 }
(...skipping 15 matching lines...) Expand all
172 180
173 #if defined(OS_CHROMEOS) 181 #if defined(OS_CHROMEOS)
174 void TrayDisplay::OnDisplayModeChanged() { 182 void TrayDisplay::OnDisplayModeChanged() {
175 if (default_) 183 if (default_)
176 default_->Update(); 184 default_->Update();
177 } 185 }
178 #endif 186 #endif
179 187
180 } // namespace internal 188 } // namespace internal
181 } // namespace ash 189 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/content_client/shell_browser_main_parts.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698