OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 if (!extension) | 921 if (!extension) |
922 return; | 922 return; |
923 | 923 |
924 // Move it over to the enabled list. | 924 // Move it over to the enabled list. |
925 registry_->AddEnabled(make_scoped_refptr(extension)); | 925 registry_->AddEnabled(make_scoped_refptr(extension)); |
926 registry_->RemoveDisabled(extension->id()); | 926 registry_->RemoveDisabled(extension->id()); |
927 | 927 |
928 NotifyExtensionLoaded(extension); | 928 NotifyExtensionLoaded(extension); |
929 | 929 |
930 // Notify listeners that the extension was enabled. | 930 // Notify listeners that the extension was enabled. |
931 content::NotificationService::current()->Notify( | 931 registry_->TriggerOnEnabled(extension); |
932 extensions::NOTIFICATION_EXTENSION_ENABLED, | |
933 content::Source<Profile>(profile_), | |
934 content::Details<const Extension>(extension)); | |
935 } | 932 } |
936 | 933 |
937 void ExtensionService::DisableExtension(const std::string& extension_id, | 934 void ExtensionService::DisableExtension(const std::string& extension_id, |
938 int disable_reasons) { | 935 int disable_reasons) { |
939 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 936 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
940 | 937 |
941 if (extension_prefs_->IsExtensionBlacklisted(extension_id)) | 938 if (extension_prefs_->IsExtensionBlacklisted(extension_id)) |
942 return; | 939 return; |
943 | 940 |
944 // The extension may have been disabled already. Just add the disable reasons. | 941 // The extension may have been disabled already. Just add the disable reasons. |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 } | 2561 } |
2565 | 2562 |
2566 void ExtensionService::OnProfileDestructionStarted() { | 2563 void ExtensionService::OnProfileDestructionStarted() { |
2567 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2564 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2568 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2565 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2569 it != ids_to_unload.end(); | 2566 it != ids_to_unload.end(); |
2570 ++it) { | 2567 ++it) { |
2571 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); | 2568 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); |
2572 } | 2569 } |
2573 } | 2570 } |
OLD | NEW |