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

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

Issue 297483007: Revert 270890 "Unload all apps / extensions immediately when del..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2006/src/
Patch Set: Created 6 years, 7 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 extensions_enabled_ = false; 294 extensions_enabled_ = false;
295 295
296 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, 296 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
297 content::NotificationService::AllBrowserContextsAndSources()); 297 content::NotificationService::AllBrowserContextsAndSources());
298 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 298 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
299 content::NotificationService::AllBrowserContextsAndSources()); 299 content::NotificationService::AllBrowserContextsAndSources());
300 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 300 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
301 content::NotificationService::AllBrowserContextsAndSources()); 301 content::NotificationService::AllBrowserContextsAndSources());
302 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 302 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
303 content::NotificationService::AllBrowserContextsAndSources()); 303 content::NotificationService::AllBrowserContextsAndSources());
304 registrar_.Add(this,
305 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
306 content::Source<Profile>(profile_));
307 pref_change_registrar_.Init(profile->GetPrefs()); 304 pref_change_registrar_.Init(profile->GetPrefs());
308 base::Closure callback = 305 base::Closure callback =
309 base::Bind(&ExtensionService::OnExtensionInstallPrefChanged, 306 base::Bind(&ExtensionService::OnExtensionInstallPrefChanged,
310 base::Unretained(this)); 307 base::Unretained(this));
311 pref_change_registrar_.Add(extensions::pref_names::kInstallAllowList, 308 pref_change_registrar_.Add(extensions::pref_names::kInstallAllowList,
312 callback); 309 callback);
313 pref_change_registrar_.Add(extensions::pref_names::kInstallDenyList, 310 pref_change_registrar_.Add(extensions::pref_names::kInstallDenyList,
314 callback); 311 callback);
315 pref_change_registrar_.Add(extensions::pref_names::kAllowedTypes, callback); 312 pref_change_registrar_.Add(extensions::pref_names::kAllowedTypes, callback);
316 313
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 system_->info_map(), 2158 system_->info_map(),
2162 process->GetID())); 2159 process->GetID()));
2163 break; 2160 break;
2164 } 2161 }
2165 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 2162 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
2166 // Notify observers that chrome update is available. 2163 // Notify observers that chrome update is available.
2167 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_, 2164 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_,
2168 OnChromeUpdateAvailable()); 2165 OnChromeUpdateAvailable());
2169 break; 2166 break;
2170 } 2167 }
2171 case chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED: {
2172 OnProfileDestructionStarted();
2173 break;
2174 }
2175 2168
2176 default: 2169 default:
2177 NOTREACHED() << "Unexpected notification type."; 2170 NOTREACHED() << "Unexpected notification type.";
2178 } 2171 }
2179 } 2172 }
2180 2173
2181 void ExtensionService::OnExtensionInstallPrefChanged() { 2174 void ExtensionService::OnExtensionInstallPrefChanged() {
2182 error_controller_->ShowErrorIfNeeded(); 2175 error_controller_->ShowErrorIfNeeded();
2183 CheckManagementPolicy(); 2176 CheckManagementPolicy();
2184 } 2177 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 void ExtensionService::UnloadAllExtensionsInternal() { 2421 void ExtensionService::UnloadAllExtensionsInternal() {
2429 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2422 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2430 2423
2431 registry_->ClearAll(); 2424 registry_->ClearAll();
2432 system_->runtime_data()->ClearAll(); 2425 system_->runtime_data()->ClearAll();
2433 2426
2434 // TODO(erikkay) should there be a notification for this? We can't use 2427 // TODO(erikkay) should there be a notification for this? We can't use
2435 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2428 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2436 // or uninstalled. 2429 // or uninstalled.
2437 } 2430 }
2438
2439 void ExtensionService::OnProfileDestructionStarted() {
2440 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2441 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2442 it != ids_to_unload.end();
2443 ++it) {
2444 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2445 }
2446 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698