Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 139943005: Convert extensions::ProcessMap to BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_map Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "content/public/browser/url_data_source.h" 75 #include "content/public/browser/url_data_source.h"
76 #include "extensions/browser/app_sorting.h" 76 #include "extensions/browser/app_sorting.h"
77 #include "extensions/browser/event_router.h" 77 #include "extensions/browser/event_router.h"
78 #include "extensions/browser/extension_registry.h" 78 #include "extensions/browser/extension_registry.h"
79 #include "extensions/browser/extensions_browser_client.h" 79 #include "extensions/browser/extensions_browser_client.h"
80 #include "extensions/browser/external_provider_interface.h" 80 #include "extensions/browser/external_provider_interface.h"
81 #include "extensions/browser/management_policy.h" 81 #include "extensions/browser/management_policy.h"
82 #include "extensions/browser/pending_extension_manager.h" 82 #include "extensions/browser/pending_extension_manager.h"
83 #include "extensions/browser/pref_names.h" 83 #include "extensions/browser/pref_names.h"
84 #include "extensions/browser/process_manager.h" 84 #include "extensions/browser/process_manager.h"
85 #include "extensions/browser/process_map.h"
85 #include "extensions/browser/update_observer.h" 86 #include "extensions/browser/update_observer.h"
86 #include "extensions/common/constants.h" 87 #include "extensions/common/constants.h"
87 #include "extensions/common/error_utils.h" 88 #include "extensions/common/error_utils.h"
88 #include "extensions/common/extension.h" 89 #include "extensions/common/extension.h"
89 #include "extensions/common/extensions_client.h" 90 #include "extensions/common/extensions_client.h"
90 #include "extensions/common/feature_switch.h" 91 #include "extensions/common/feature_switch.h"
91 #include "extensions/common/manifest.h" 92 #include "extensions/common/manifest.h"
92 #include "extensions/common/manifest_constants.h" 93 #include "extensions/common/manifest_constants.h"
93 #include "extensions/common/manifest_handlers/background_info.h" 94 #include "extensions/common/manifest_handlers/background_info.h"
94 #include "extensions/common/manifest_handlers/incognito_info.h" 95 #include "extensions/common/manifest_handlers/incognito_info.h"
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 break; 2551 break;
2551 } 2552 }
2552 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { 2553 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
2553 content::RenderProcessHost* process = 2554 content::RenderProcessHost* process =
2554 content::Source<content::RenderProcessHost>(source).ptr(); 2555 content::Source<content::RenderProcessHost>(source).ptr();
2555 Profile* host_profile = 2556 Profile* host_profile =
2556 Profile::FromBrowserContext(process->GetBrowserContext()); 2557 Profile::FromBrowserContext(process->GetBrowserContext());
2557 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) 2558 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile()))
2558 break; 2559 break;
2559 2560
2560 if (process_map_.Contains(process->GetID())) { 2561 extensions::ProcessMap* process_map =
2562 extensions::ProcessMap::Get(profile_);
2563 if (process_map->Contains(process->GetID())) {
2561 // An extension process was terminated, this might have resulted in an 2564 // An extension process was terminated, this might have resulted in an
2562 // app or extension becoming idle. 2565 // app or extension becoming idle.
2563 std::set<std::string> extension_ids = 2566 std::set<std::string> extension_ids =
2564 process_map_.GetExtensionsInProcess(process->GetID()); 2567 process_map->GetExtensionsInProcess(process->GetID());
2565 for (std::set<std::string>::const_iterator it = extension_ids.begin(); 2568 for (std::set<std::string>::const_iterator it = extension_ids.begin();
2566 it != extension_ids.end(); ++it) { 2569 it != extension_ids.end(); ++it) {
2567 if (delayed_installs_.Contains(*it)) { 2570 if (delayed_installs_.Contains(*it)) {
2568 base::MessageLoop::current()->PostDelayedTask( 2571 base::MessageLoop::current()->PostDelayedTask(
2569 FROM_HERE, 2572 FROM_HERE,
2570 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation, 2573 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation,
2571 AsWeakPtr(), *it), 2574 AsWeakPtr(), *it),
2572 base::TimeDelta::FromSeconds(kUpdateIdleDelay)); 2575 base::TimeDelta::FromSeconds(kUpdateIdleDelay));
2573 } 2576 }
2574 } 2577 }
2575 } 2578 }
2576 2579
2577 process_map_.RemoveAllFromProcess(process->GetID()); 2580 process_map->RemoveAllFromProcess(process->GetID());
2578 BrowserThread::PostTask( 2581 BrowserThread::PostTask(
2579 BrowserThread::IO, 2582 BrowserThread::IO,
2580 FROM_HERE, 2583 FROM_HERE,
2581 base::Bind(&extensions::InfoMap::UnregisterAllExtensionsInProcess, 2584 base::Bind(&extensions::InfoMap::UnregisterAllExtensionsInProcess,
2582 system_->info_map(), 2585 system_->info_map(),
2583 process->GetID())); 2586 process->GetID()));
2584 break; 2587 break;
2585 } 2588 }
2586 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 2589 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
2587 // Notify observers that chrome update is available. 2590 // Notify observers that chrome update is available.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 void ExtensionService::UnloadAllExtensionsInternal() { 2821 void ExtensionService::UnloadAllExtensionsInternal() {
2819 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2822 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2820 2823
2821 registry_->ClearAll(); 2824 registry_->ClearAll();
2822 extension_runtime_data_.clear(); 2825 extension_runtime_data_.clear();
2823 2826
2824 // TODO(erikkay) should there be a notification for this? We can't use 2827 // TODO(erikkay) should there be a notification for this? We can't use
2825 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2828 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2826 // or uninstalled. 2829 // or uninstalled.
2827 } 2830 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/isolated_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698