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

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

Issue 21443002: Add NOTIFICATION_EXTENSION_REMOVED for Extensions removed from ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 if (IsUnacknowledgedExternalExtension(extension)) { 914 if (IsUnacknowledgedExternalExtension(extension)) {
915 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEvent", 915 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEvent",
916 EXTERNAL_EXTENSION_REENABLED, 916 EXTERNAL_EXTENSION_REENABLED,
917 EXTERNAL_EXTENSION_BUCKET_BOUNDARY); 917 EXTERNAL_EXTENSION_BUCKET_BOUNDARY);
918 AcknowledgeExternalExtension(extension->id()); 918 AcknowledgeExternalExtension(extension->id());
919 } 919 }
920 920
921 // Move it over to the enabled list. 921 // Move it over to the enabled list.
922 extensions_.Insert(make_scoped_refptr(extension)); 922 extensions_.Insert(make_scoped_refptr(extension));
923 disabled_extensions_.Remove(extension->id()); 923 disabled_extensions_.Remove(extension->id());
924 FOR_EACH_OBSERVER(DisabledExtensionObserver, disabled_extension_observers_,
925 OnDisabledExtensionRemoved(extension, true));
924 926
925 NotifyExtensionLoaded(extension); 927 NotifyExtensionLoaded(extension);
926 928
927 // Notify listeners that the extension was enabled. 929 // Notify listeners that the extension was enabled.
928 content::NotificationService::current()->Notify( 930 content::NotificationService::current()->Notify(
929 chrome::NOTIFICATION_EXTENSION_ENABLED, 931 chrome::NOTIFICATION_EXTENSION_ENABLED,
930 content::Source<Profile>(profile_), 932 content::Source<Profile>(profile_),
931 content::Details<const Extension>(extension)); 933 content::Details<const Extension>(extension));
932 934
933 SyncExtensionChangeIfNeeded(*extension); 935 SyncExtensionChangeIfNeeded(*extension);
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 // Clean up if the extension is meant to be enabled after a reload. 1875 // Clean up if the extension is meant to be enabled after a reload.
1874 reloading_extensions_.erase(extension->id()); 1876 reloading_extensions_.erase(extension->id());
1875 1877
1876 // Clean up runtime data. 1878 // Clean up runtime data.
1877 extension_runtime_data_.erase(extension_id); 1879 extension_runtime_data_.erase(extension_id);
1878 1880
1879 if (disabled_extensions_.Contains(extension->id())) { 1881 if (disabled_extensions_.Contains(extension->id())) {
1880 UnloadedExtensionInfo details(extension.get(), reason); 1882 UnloadedExtensionInfo details(extension.get(), reason);
1881 details.already_disabled = true; 1883 details.already_disabled = true;
1882 disabled_extensions_.Remove(extension->id()); 1884 disabled_extensions_.Remove(extension->id());
1885 FOR_EACH_OBSERVER(DisabledExtensionObserver, disabled_extension_observers_,
1886 OnDisabledExtensionRemoved(extension.get(), false));
1883 content::NotificationService::current()->Notify( 1887 content::NotificationService::current()->Notify(
1884 chrome::NOTIFICATION_EXTENSION_UNLOADED, 1888 chrome::NOTIFICATION_EXTENSION_UNLOADED,
1885 content::Source<Profile>(profile_), 1889 content::Source<Profile>(profile_),
1886 content::Details<UnloadedExtensionInfo>(&details)); 1890 content::Details<UnloadedExtensionInfo>(&details));
1887 // Make sure the profile cleans up its RequestContexts when an already 1891 // Make sure the profile cleans up its RequestContexts when an already
1888 // disabled extension is unloaded (since they are also tracking the disabled 1892 // disabled extension is unloaded (since they are also tracking the disabled
1889 // extensions). 1893 // extensions).
1890 system_->UnregisterExtensionWithRequestContexts(extension_id, reason); 1894 system_->UnregisterExtensionWithRequestContexts(extension_id, reason);
1891 return; 1895 return;
1892 } 1896 }
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 } 3115 }
3112 3116
3113 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3117 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3114 update_observers_.AddObserver(observer); 3118 update_observers_.AddObserver(observer);
3115 } 3119 }
3116 3120
3117 void ExtensionService::RemoveUpdateObserver( 3121 void ExtensionService::RemoveUpdateObserver(
3118 extensions::UpdateObserver* observer) { 3122 extensions::UpdateObserver* observer) {
3119 update_observers_.RemoveObserver(observer); 3123 update_observers_.RemoveObserver(observer);
3120 } 3124 }
3125
3126 void ExtensionService::AddDisabledExtensionObserver(
3127 ExtensionService::DisabledExtensionObserver* observer) {
3128 disabled_extension_observers_.AddObserver(observer);
3129 }
3130
3131 void ExtensionService::RemoveDisabledExtensionObserver(
3132 ExtensionService::DisabledExtensionObserver* observer) {
3133 disabled_extension_observers_.RemoveObserver(observer);
3134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698