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

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: take 2 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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 details.already_disabled = true; 1881 details.already_disabled = true;
1882 disabled_extensions_.Remove(extension->id()); 1882 disabled_extensions_.Remove(extension->id());
1883 content::NotificationService::current()->Notify( 1883 content::NotificationService::current()->Notify(
1884 chrome::NOTIFICATION_EXTENSION_UNLOADED, 1884 chrome::NOTIFICATION_EXTENSION_UNLOADED,
1885 content::Source<Profile>(profile_), 1885 content::Source<Profile>(profile_),
1886 content::Details<UnloadedExtensionInfo>(&details)); 1886 content::Details<UnloadedExtensionInfo>(&details));
1887 // Make sure the profile cleans up its RequestContexts when an already 1887 // Make sure the profile cleans up its RequestContexts when an already
1888 // disabled extension is unloaded (since they are also tracking the disabled 1888 // disabled extension is unloaded (since they are also tracking the disabled
1889 // extensions). 1889 // extensions).
1890 system_->UnregisterExtensionWithRequestContexts(extension_id, reason); 1890 system_->UnregisterExtensionWithRequestContexts(extension_id, reason);
1891 return; 1891 return;
Matt Perry 2013/08/01 22:06:35 You need to dispatch the notification here, too. O
Yoyo Zhou 2013/08/01 22:10:22 Of course.
1892 } 1892 }
1893 1893
1894 // Remove the extension from our list. 1894 // Remove the extension from our list.
1895 extensions_.Remove(extension->id()); 1895 extensions_.Remove(extension->id());
1896 1896
1897 NotifyExtensionUnloaded(extension.get(), reason); 1897 NotifyExtensionUnloaded(extension.get(), reason);
1898
1899 content::NotificationService::current()->Notify(
1900 chrome::NOTIFICATION_EXTENSION_REMOVED,
1901 content::Source<Profile>(profile_),
1902 content::Details<const Extension>(extension.get()));
1898 } 1903 }
1899 1904
1900 void ExtensionService::UnloadAllExtensions() { 1905 void ExtensionService::UnloadAllExtensions() {
1901 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 1906 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
1902 1907
1903 extensions_.Clear(); 1908 extensions_.Clear();
1904 disabled_extensions_.Clear(); 1909 disabled_extensions_.Clear();
1905 terminated_extensions_.Clear(); 1910 terminated_extensions_.Clear();
1906 extension_runtime_data_.clear(); 1911 extension_runtime_data_.clear();
1907 1912
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 2597
2593 void ExtensionService::TrackTerminatedExtension(const Extension* extension) { 2598 void ExtensionService::TrackTerminatedExtension(const Extension* extension) {
2594 if (!terminated_extensions_.Contains(extension->id())) 2599 if (!terminated_extensions_.Contains(extension->id()))
2595 terminated_extensions_.Insert(make_scoped_refptr(extension)); 2600 terminated_extensions_.Insert(make_scoped_refptr(extension));
2596 2601
2597 UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_TERMINATE); 2602 UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_TERMINATE);
2598 } 2603 }
2599 2604
2600 void ExtensionService::UntrackTerminatedExtension(const std::string& id) { 2605 void ExtensionService::UntrackTerminatedExtension(const std::string& id) {
2601 std::string lowercase_id = StringToLowerASCII(id); 2606 std::string lowercase_id = StringToLowerASCII(id);
2607 const Extension* extension = terminated_extensions_.GetByID(lowercase_id);
2602 terminated_extensions_.Remove(lowercase_id); 2608 terminated_extensions_.Remove(lowercase_id);
2609 if (extension) {
2610 content::NotificationService::current()->Notify(
2611 chrome::NOTIFICATION_EXTENSION_REMOVED,
2612 content::Source<Profile>(profile_),
2613 content::Details<const Extension>(extension));
2614 }
2603 } 2615 }
2604 2616
2605 const Extension* ExtensionService::GetTerminatedExtension( 2617 const Extension* ExtensionService::GetTerminatedExtension(
2606 const std::string& id) const { 2618 const std::string& id) const {
2607 return GetExtensionById(id, INCLUDE_TERMINATED); 2619 return GetExtensionById(id, INCLUDE_TERMINATED);
2608 } 2620 }
2609 2621
2610 const Extension* ExtensionService::GetInstalledExtension( 2622 const Extension* ExtensionService::GetInstalledExtension(
2611 const std::string& id) const { 2623 const std::string& id) const {
2612 int include_mask = INCLUDE_ENABLED | 2624 int include_mask = INCLUDE_ENABLED |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 } 3123 }
3112 3124
3113 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3125 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3114 update_observers_.AddObserver(observer); 3126 update_observers_.AddObserver(observer);
3115 } 3127 }
3116 3128
3117 void ExtensionService::RemoveUpdateObserver( 3129 void ExtensionService::RemoveUpdateObserver(
3118 extensions::UpdateObserver* observer) { 3130 extensions::UpdateObserver* observer) {
3119 update_observers_.RemoveObserver(observer); 3131 update_observers_.RemoveObserver(observer);
3120 } 3132 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_disabled_ui.cc ('k') | chrome/browser/extensions/external_install_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698