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

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

Issue 289283013: Revert of Unload all apps / extensions when deleting a profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 system_->info_map(), 2145 system_->info_map(),
2149 process->GetID())); 2146 process->GetID()));
2150 break; 2147 break;
2151 } 2148 }
2152 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 2149 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
2153 // Notify observers that chrome update is available. 2150 // Notify observers that chrome update is available.
2154 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_, 2151 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_,
2155 OnChromeUpdateAvailable()); 2152 OnChromeUpdateAvailable());
2156 break; 2153 break;
2157 } 2154 }
2158 case chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED: {
2159 OnProfileDestructionStarted();
2160 break;
2161 }
2162 2155
2163 default: 2156 default:
2164 NOTREACHED() << "Unexpected notification type."; 2157 NOTREACHED() << "Unexpected notification type.";
2165 } 2158 }
2166 } 2159 }
2167 2160
2168 void ExtensionService::OnExtensionInstallPrefChanged() { 2161 void ExtensionService::OnExtensionInstallPrefChanged() {
2169 error_controller_->ShowErrorIfNeeded(); 2162 error_controller_->ShowErrorIfNeeded();
2170 CheckManagementPolicy(); 2163 CheckManagementPolicy();
2171 } 2164 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 void ExtensionService::UnloadAllExtensionsInternal() { 2408 void ExtensionService::UnloadAllExtensionsInternal() {
2416 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2409 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2417 2410
2418 registry_->ClearAll(); 2411 registry_->ClearAll();
2419 system_->runtime_data()->ClearAll(); 2412 system_->runtime_data()->ClearAll();
2420 2413
2421 // TODO(erikkay) should there be a notification for this? We can't use 2414 // TODO(erikkay) should there be a notification for this? We can't use
2422 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2415 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2423 // or uninstalled. 2416 // or uninstalled.
2424 } 2417 }
2425
2426 void ExtensionService::OnProfileDestructionStarted() {
2427 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2428 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2429 it != ids_to_unload.end();
2430 ++it) {
2431 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2432 }
2433 }
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