| 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/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 478 } |
| 479 | 479 |
| 480 SystemTray::~SystemTray() { | 480 SystemTray::~SystemTray() { |
| 481 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); | 481 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); |
| 482 it != items_.end(); | 482 it != items_.end(); |
| 483 ++it) { | 483 ++it) { |
| 484 (*it)->DestroyTrayView(); | 484 (*it)->DestroyTrayView(); |
| 485 } | 485 } |
| 486 if (popup_) | 486 if (popup_) |
| 487 popup_->CloseNow(); | 487 popup_->CloseNow(); |
| 488 ash::Shell::GetInstance()->tray_delegate()->OnTrayDestroyed(); |
| 488 } | 489 } |
| 489 | 490 |
| 490 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 491 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| 491 items_.push_back(item); | 492 items_.push_back(item); |
| 492 | 493 |
| 493 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 494 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
| 494 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); | 495 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); |
| 495 if (tray_item) { | 496 if (tray_item) { |
| 496 container_->AddChildViewAt(new TrayItemContainer(tray_item), 0); | 497 container_->AddChildViewAt(new TrayItemContainer(tray_item), 0); |
| 497 PreferredSizeChanged(); | 498 PreferredSizeChanged(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 popup_->Hide(); | 677 popup_->Hide(); |
| 677 } | 678 } |
| 678 } | 679 } |
| 679 return base::EVENT_CONTINUE; | 680 return base::EVENT_CONTINUE; |
| 680 } | 681 } |
| 681 | 682 |
| 682 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { | 683 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { |
| 683 } | 684 } |
| 684 | 685 |
| 685 } // namespace ash | 686 } // namespace ash |
| OLD | NEW |