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/status_area_widget.h" | 5 #include "ash/system/status_area_widget.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 system_tray_->Initialize(); // Called after added to widget. | 318 system_tray_->Initialize(); // Called after added to widget. |
319 | 319 |
320 if (shell_delegate) { | 320 if (shell_delegate) { |
321 system_tray_delegate_.reset( | 321 system_tray_delegate_.reset( |
322 shell_delegate->CreateSystemTrayDelegate(system_tray)); | 322 shell_delegate->CreateSystemTrayDelegate(system_tray)); |
323 } | 323 } |
324 if (!system_tray_delegate_.get()) | 324 if (!system_tray_delegate_.get()) |
325 system_tray_delegate_.reset(new DummySystemTrayDelegate()); | 325 system_tray_delegate_.reset(new DummySystemTrayDelegate()); |
326 | 326 |
327 system_tray->CreateItems(); // Called after delegate is created. | 327 system_tray->CreateItems(); // Called after delegate is created. |
| 328 UpdateAfterLoginStatusChange(system_tray_delegate_->GetUserLoginStatus()); |
328 } | 329 } |
329 | 330 |
330 void StatusAreaWidget::AddWebNotificationTray( | 331 void StatusAreaWidget::AddWebNotificationTray( |
331 WebNotificationTray* web_notification_tray) { | 332 WebNotificationTray* web_notification_tray) { |
332 web_notification_tray_ = web_notification_tray; | 333 web_notification_tray_ = web_notification_tray; |
333 widget_delegate_->AddTray(web_notification_tray); | 334 widget_delegate_->AddTray(web_notification_tray); |
334 } | 335 } |
335 | 336 |
336 void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) { | 337 void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) { |
337 widget_delegate_->set_alignment(alignment); | 338 widget_delegate_->set_alignment(alignment); |
(...skipping 22 matching lines...) Expand all Loading... |
360 if (system_tray_) | 361 if (system_tray_) |
361 system_tray_->SetHideNotifications(hide); | 362 system_tray_->SetHideNotifications(hide); |
362 } | 363 } |
363 | 364 |
364 bool StatusAreaWidget::ShouldShowNonSystemNotifications() { | 365 bool StatusAreaWidget::ShouldShowNonSystemNotifications() { |
365 return !(system_tray_ && system_tray_->IsAnyBubbleVisible()); | 366 return !(system_tray_ && system_tray_->IsAnyBubbleVisible()); |
366 } | 367 } |
367 | 368 |
368 void StatusAreaWidget::UpdateAfterLoginStatusChange( | 369 void StatusAreaWidget::UpdateAfterLoginStatusChange( |
369 user::LoginStatus login_status) { | 370 user::LoginStatus login_status) { |
| 371 if (login_status_ == login_status) |
| 372 return; |
370 login_status_ = login_status; | 373 login_status_ = login_status; |
371 if (system_tray_) | 374 if (system_tray_) |
372 system_tray_->UpdateAfterLoginStatusChange(login_status); | 375 system_tray_->UpdateAfterLoginStatusChange(login_status); |
373 if (web_notification_tray_) | 376 if (web_notification_tray_) |
374 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 377 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
375 } | 378 } |
376 | 379 |
377 } // namespace internal | 380 } // namespace internal |
378 } // namespace ash | 381 } // namespace ash |
OLD | NEW |