OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/task_manager.h" | 5 #include "chrome/browser/task_manager.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 703 |
704 TaskManager::~TaskManager() { | 704 TaskManager::~TaskManager() { |
705 } | 705 } |
706 | 706 |
707 // static | 707 // static |
708 void TaskManager::Open() { | 708 void TaskManager::Open() { |
709 TaskManager* task_manager = GetInstance(); | 709 TaskManager* task_manager = GetInstance(); |
710 task_manager->view_->OpenWindow(); | 710 task_manager->view_->OpenWindow(); |
711 } | 711 } |
712 | 712 |
| 713 // static |
713 void TaskManager::Close() { | 714 void TaskManager::Close() { |
714 model_->StopUpdating(); | 715 TaskManager* task_manager = GetInstance(); |
715 model_->Clear(); | 716 task_manager->view_->CloseWindow(); |
716 } | 717 } |
717 | 718 |
718 // static | 719 // static |
719 void TaskManager::EnsureShutdown() { | 720 void TaskManager::EnsureShutdown() { |
720 if (!initialized_) | 721 if (!initialized_) |
721 return; | 722 return; |
722 | 723 |
723 // TaskManager is a singleton, which means it's destroyed by AtExitManager. | 724 // TaskManager is a singleton, which means it's destroyed by AtExitManager. |
724 // At that point it can't register AtExit callbacks etc. It turns out that | 725 // At that point it can't register AtExit callbacks etc. It turns out that |
725 // view destruction code does it on Windows, so we destroy the view now. | 726 // view destruction code does it on Windows, so we destroy the view now. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 796 } |
796 | 797 |
797 void TaskManager::AddResource(Resource* resource) { | 798 void TaskManager::AddResource(Resource* resource) { |
798 model_->AddResource(resource); | 799 model_->AddResource(resource); |
799 } | 800 } |
800 | 801 |
801 void TaskManager::RemoveResource(Resource* resource) { | 802 void TaskManager::RemoveResource(Resource* resource) { |
802 model_->RemoveResource(resource); | 803 model_->RemoveResource(resource); |
803 } | 804 } |
804 | 805 |
| 806 void TaskManager::OnWindowClosed() { |
| 807 model_->StopUpdating(); |
| 808 model_->Clear(); |
| 809 } |
| 810 |
805 // static | 811 // static |
806 TaskManager* TaskManager::GetInstance() { | 812 TaskManager* TaskManager::GetInstance() { |
807 return Singleton<TaskManager>::get(); | 813 return Singleton<TaskManager>::get(); |
808 } | 814 } |
OLD | NEW |