| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/background_contents_service.h" | 17 #include "chrome/browser/background_contents_service.h" |
| 18 #include "chrome/browser/background_contents_service_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/extensions/extension_host.h" | 20 #include "chrome/browser/extensions/extension_host.h" |
| 20 #include "chrome/browser/extensions/extension_process_manager.h" | 21 #include "chrome/browser/extensions/extension_process_manager.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/notifications/balloon_collection.h" | 23 #include "chrome/browser/notifications/balloon_collection.h" |
| 23 #include "chrome/browser/notifications/balloon_host.h" | 24 #include "chrome/browser/notifications/balloon_host.h" |
| 24 #include "chrome/browser/notifications/notification_ui_manager.h" | 25 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 25 #include "chrome/browser/prerender/prerender_contents.h" | 26 #include "chrome/browser/prerender/prerender_contents.h" |
| 26 #include "chrome/browser/prerender/prerender_manager.h" | 27 #include "chrome/browser/prerender/prerender_manager.h" |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 | 681 |
| 681 void TaskManagerBackgroundContentsResourceProvider::StartUpdating() { | 682 void TaskManagerBackgroundContentsResourceProvider::StartUpdating() { |
| 682 DCHECK(!updating_); | 683 DCHECK(!updating_); |
| 683 updating_ = true; | 684 updating_ = true; |
| 684 | 685 |
| 685 // Add all the existing BackgroundContents from every profile. | 686 // Add all the existing BackgroundContents from every profile. |
| 686 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 687 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 687 for (ProfileManager::const_iterator it = profile_manager->begin(); | 688 for (ProfileManager::const_iterator it = profile_manager->begin(); |
| 688 it != profile_manager->end(); ++it) { | 689 it != profile_manager->end(); ++it) { |
| 689 BackgroundContentsService* background_contents_service = | 690 BackgroundContentsService* background_contents_service = |
| 690 (*it)->GetBackgroundContentsService(); | 691 BackgroundContentsServiceFactory::GetForProfile(*it); |
| 691 ExtensionService* extensions_service = (*it)->GetExtensionService(); | 692 ExtensionService* extensions_service = (*it)->GetExtensionService(); |
| 692 std::vector<BackgroundContents*> contents = | 693 std::vector<BackgroundContents*> contents = |
| 693 background_contents_service->GetBackgroundContents(); | 694 background_contents_service->GetBackgroundContents(); |
| 694 for (std::vector<BackgroundContents*>::iterator iterator = contents.begin(); | 695 for (std::vector<BackgroundContents*>::iterator iterator = contents.begin(); |
| 695 iterator != contents.end(); ++iterator) { | 696 iterator != contents.end(); ++iterator) { |
| 696 string16 application_name; | 697 string16 application_name; |
| 697 // Lookup the name from the parent extension. | 698 // Lookup the name from the parent extension. |
| 698 if (extensions_service) { | 699 if (extensions_service) { |
| 699 const string16& application_id = | 700 const string16& application_id = |
| 700 background_contents_service->GetParentApplicationId(*iterator); | 701 background_contents_service->GetParentApplicationId(*iterator); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 | 1573 |
| 1573 return &resource_; | 1574 return &resource_; |
| 1574 } | 1575 } |
| 1575 | 1576 |
| 1576 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1577 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 1577 task_manager_->AddResource(&resource_); | 1578 task_manager_->AddResource(&resource_); |
| 1578 } | 1579 } |
| 1579 | 1580 |
| 1580 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1581 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 1581 } | 1582 } |
| OLD | NEW |