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 "chrome/browser/task_manager/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 return i->second; | 620 return i->second; |
621 } | 621 } |
622 } | 622 } |
623 | 623 |
624 // Can happen if the panel went away while a network request was being | 624 // Can happen if the panel went away while a network request was being |
625 // performed. | 625 // performed. |
626 return NULL; | 626 return NULL; |
627 } | 627 } |
628 | 628 |
629 void TaskManagerPanelResourceProvider::StartUpdating() { | 629 void TaskManagerPanelResourceProvider::StartUpdating() { |
630 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 630 if (!PanelManager::UseBrowserlessPanels()) |
631 switches::kBrowserlessPanels)) | |
632 return; | 631 return; |
633 | 632 |
634 DCHECK(!updating_); | 633 DCHECK(!updating_); |
635 updating_ = true; | 634 updating_ = true; |
636 | 635 |
637 // Add all the Panels. | 636 // Add all the Panels. |
638 std::vector<Panel*> panels = PanelManager::GetInstance()->panels(); | 637 std::vector<Panel*> panels = PanelManager::GetInstance()->panels(); |
639 for (size_t i = 0; i < panels.size(); ++i) | 638 for (size_t i = 0; i < panels.size(); ++i) |
640 Add(panels[i]); | 639 Add(panels[i]); |
641 | 640 |
642 // Then we register for notifications to get new and remove closed panels. | 641 // Then we register for notifications to get new and remove closed panels. |
643 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 642 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
644 content::NotificationService::AllSources()); | 643 content::NotificationService::AllSources()); |
645 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 644 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
646 content::NotificationService::AllSources()); | 645 content::NotificationService::AllSources()); |
647 } | 646 } |
648 | 647 |
649 void TaskManagerPanelResourceProvider::StopUpdating() { | 648 void TaskManagerPanelResourceProvider::StopUpdating() { |
650 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 649 if (!PanelManager::UseBrowserlessPanels()) |
651 switches::kBrowserlessPanels)) | |
652 return; | 650 return; |
653 | 651 |
654 DCHECK(updating_); | 652 DCHECK(updating_); |
655 updating_ = false; | 653 updating_ = false; |
656 | 654 |
657 // Unregister for notifications about new/removed panels. | 655 // Unregister for notifications about new/removed panels. |
658 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 656 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
659 content::NotificationService::AllSources()); | 657 content::NotificationService::AllSources()); |
660 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 658 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
661 content::NotificationService::AllSources()); | 659 content::NotificationService::AllSources()); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 | 1695 |
1698 return &resource_; | 1696 return &resource_; |
1699 } | 1697 } |
1700 | 1698 |
1701 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1699 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
1702 task_manager_->AddResource(&resource_); | 1700 task_manager_->AddResource(&resource_); |
1703 } | 1701 } |
1704 | 1702 |
1705 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1703 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
1706 } | 1704 } |
OLD | NEW |