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/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/panel_window.h" | 8 #include "ash/shell/panel_window.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/system/audio/tray_volume.h" | 10 #include "ash/system/audio/tray_volume.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 accessibility_observer_(NULL), | 128 accessibility_observer_(NULL), |
129 audio_observer_(NULL), | 129 audio_observer_(NULL), |
130 bluetooth_observer_(NULL), | 130 bluetooth_observer_(NULL), |
131 brightness_observer_(NULL), | 131 brightness_observer_(NULL), |
132 caps_lock_observer_(NULL), | 132 caps_lock_observer_(NULL), |
133 clock_observer_(NULL), | 133 clock_observer_(NULL), |
134 drive_observer_(NULL), | 134 drive_observer_(NULL), |
135 ime_observer_(NULL), | 135 ime_observer_(NULL), |
136 locale_observer_(NULL), | 136 locale_observer_(NULL), |
137 network_observer_(NULL), | 137 network_observer_(NULL), |
138 power_status_observer_(NULL), | |
139 update_observer_(NULL), | 138 update_observer_(NULL), |
140 user_observer_(NULL), | 139 user_observer_(NULL), |
141 should_show_launcher_(false), | 140 should_show_launcher_(false), |
142 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), | 141 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), |
143 default_bubble_height_(0) { | 142 default_bubble_height_(0) { |
144 tray_container_ = new internal::SystemTrayContainer; | 143 tray_container_ = new internal::SystemTrayContainer; |
145 tray_container_->SetLayoutManager(new views::BoxLayout( | 144 tray_container_->SetLayoutManager(new views::BoxLayout( |
146 views::BoxLayout::kHorizontal, 0, 0, 0)); | 145 views::BoxLayout::kHorizontal, 0, 0, 0)); |
147 tray_container_->set_border( | 146 tray_container_->set_border( |
148 views::Border::CreateEmptyBorder(1, 1, 1, 1)); | 147 views::Border::CreateEmptyBorder(1, 1, 1, 1)); |
(...skipping 25 matching lines...) Expand all Loading... |
174 internal::TrayNetwork* tray_network = new internal::TrayNetwork; | 173 internal::TrayNetwork* tray_network = new internal::TrayNetwork; |
175 internal::TraySms* tray_sms = new internal::TraySms(); | 174 internal::TraySms* tray_sms = new internal::TraySms(); |
176 internal::TrayUser* tray_user = new internal::TrayUser; | 175 internal::TrayUser* tray_user = new internal::TrayUser; |
177 internal::TrayAccessibility* tray_accessibility = | 176 internal::TrayAccessibility* tray_accessibility = |
178 new internal::TrayAccessibility; | 177 new internal::TrayAccessibility; |
179 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; | 178 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; |
180 internal::TrayDrive* tray_drive = new internal::TrayDrive; | 179 internal::TrayDrive* tray_drive = new internal::TrayDrive; |
181 internal::TrayIME* tray_ime = new internal::TrayIME; | 180 internal::TrayIME* tray_ime = new internal::TrayIME; |
182 internal::TrayLocale* tray_locale = new internal::TrayLocale; | 181 internal::TrayLocale* tray_locale = new internal::TrayLocale; |
183 internal::TrayUpdate* tray_update = new internal::TrayUpdate; | 182 internal::TrayUpdate* tray_update = new internal::TrayUpdate; |
| 183 internal::TraySettings* tray_settings = new internal::TraySettings(); |
184 | 184 |
185 accessibility_observer_ = tray_accessibility; | 185 accessibility_observer_ = tray_accessibility; |
186 audio_observer_ = tray_volume; | 186 audio_observer_ = tray_volume; |
187 bluetooth_observer_ = tray_bluetooth; | 187 bluetooth_observer_ = tray_bluetooth; |
188 brightness_observer_ = tray_brightness; | 188 brightness_observer_ = tray_brightness; |
189 caps_lock_observer_ = tray_caps_lock; | 189 caps_lock_observer_ = tray_caps_lock; |
190 clock_observer_ = tray_date; | 190 clock_observer_ = tray_date; |
191 drive_observer_ = tray_drive; | 191 drive_observer_ = tray_drive; |
192 ime_observer_ = tray_ime; | 192 ime_observer_ = tray_ime; |
193 locale_observer_ = tray_locale; | 193 locale_observer_ = tray_locale; |
194 network_observer_ = tray_network; | 194 network_observer_ = tray_network; |
195 power_status_observer_ = tray_power; | 195 power_status_observers_.AddObserver(tray_power); |
| 196 power_status_observers_.AddObserver(tray_settings); |
196 update_observer_ = tray_update; | 197 update_observer_ = tray_update; |
197 user_observer_ = tray_user; | 198 user_observer_ = tray_user; |
198 | 199 |
199 AddTrayItem(tray_user); | 200 AddTrayItem(tray_user); |
200 AddTrayItem(tray_power); | 201 AddTrayItem(tray_power); |
201 AddTrayItem(tray_network); | 202 AddTrayItem(tray_network); |
202 AddTrayItem(tray_bluetooth); | 203 AddTrayItem(tray_bluetooth); |
203 AddTrayItem(tray_sms); | 204 AddTrayItem(tray_sms); |
204 AddTrayItem(tray_drive); | 205 AddTrayItem(tray_drive); |
205 AddTrayItem(tray_ime); | 206 AddTrayItem(tray_ime); |
206 AddTrayItem(tray_locale); | 207 AddTrayItem(tray_locale); |
207 AddTrayItem(tray_volume); | 208 AddTrayItem(tray_volume); |
208 AddTrayItem(tray_brightness); | 209 AddTrayItem(tray_brightness); |
209 AddTrayItem(tray_update); | 210 AddTrayItem(tray_update); |
210 AddTrayItem(tray_accessibility); | 211 AddTrayItem(tray_accessibility); |
211 AddTrayItem(tray_caps_lock); | 212 AddTrayItem(tray_caps_lock); |
212 AddTrayItem(new internal::TraySettings()); | 213 AddTrayItem(tray_settings); |
213 AddTrayItem(tray_date); | 214 AddTrayItem(tray_date); |
214 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> | 215 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> |
215 GetTrayVisibilityOnStartup()); | 216 GetTrayVisibilityOnStartup()); |
216 } | 217 } |
217 | 218 |
218 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 219 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
219 items_.push_back(item); | 220 items_.push_back(item); |
220 | 221 |
221 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 222 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
222 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); | 223 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 550 |
550 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { | 551 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { |
551 // The tray itself expands to the right and bottom edge of the screen to make | 552 // The tray itself expands to the right and bottom edge of the screen to make |
552 // sure clicking on the edges brings up the popup. However, the focus border | 553 // sure clicking on the edges brings up the popup. However, the focus border |
553 // should be only around the container. | 554 // should be only around the container. |
554 if (GetWidget() && GetWidget()->IsActive()) | 555 if (GetWidget() && GetWidget()->IsActive()) |
555 canvas->DrawFocusRect(tray_container_->bounds()); | 556 canvas->DrawFocusRect(tray_container_->bounds()); |
556 } | 557 } |
557 | 558 |
558 } // namespace ash | 559 } // namespace ash |
OLD | NEW |