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_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void SystemTrayBubble::RestartAutoCloseTimer() { | 376 void SystemTrayBubble::RestartAutoCloseTimer() { |
377 if (autoclose_delay_) | 377 if (autoclose_delay_) |
378 StartAutoCloseTimer(autoclose_delay_); | 378 StartAutoCloseTimer(autoclose_delay_); |
379 } | 379 } |
380 | 380 |
381 void SystemTrayBubble::Close() { | 381 void SystemTrayBubble::Close() { |
382 if (bubble_widget_) | 382 if (bubble_widget_) |
383 bubble_widget_->Close(); | 383 bubble_widget_->Close(); |
384 } | 384 } |
385 | 385 |
| 386 void SystemTrayBubble::SetVisible(bool is_visible) { |
| 387 if (!bubble_widget_) |
| 388 return; |
| 389 if (is_visible) |
| 390 bubble_widget_->Show(); |
| 391 else |
| 392 bubble_widget_->Hide(); |
| 393 } |
| 394 |
| 395 bool SystemTrayBubble::IsVisible() { |
| 396 return bubble_widget_ && bubble_widget_->IsVisible(); |
| 397 } |
| 398 |
386 void SystemTrayBubble::CreateItemViews(user::LoginStatus login_status) { | 399 void SystemTrayBubble::CreateItemViews(user::LoginStatus login_status) { |
387 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); | 400 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); |
388 it != items_.end(); | 401 it != items_.end(); |
389 ++it) { | 402 ++it) { |
390 views::View* view = NULL; | 403 views::View* view = NULL; |
391 switch (bubble_type_) { | 404 switch (bubble_type_) { |
392 case BUBBLE_TYPE_DEFAULT: | 405 case BUBBLE_TYPE_DEFAULT: |
393 view = (*it)->CreateDefaultView(login_status); | 406 view = (*it)->CreateDefaultView(login_status); |
394 break; | 407 break; |
395 case BUBBLE_TYPE_DETAILED: | 408 case BUBBLE_TYPE_DETAILED: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 462 } |
450 | 463 |
451 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { | 464 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { |
452 CHECK_EQ(bubble_widget_, widget); | 465 CHECK_EQ(bubble_widget_, widget); |
453 bubble_widget_ = NULL; | 466 bubble_widget_ = NULL; |
454 tray_->RemoveBubble(this); | 467 tray_->RemoveBubble(this); |
455 } | 468 } |
456 | 469 |
457 } // namespace internal | 470 } // namespace internal |
458 } // namespace ash | 471 } // namespace ash |
OLD | NEW |