Index: chrome/browser/autocomplete/shortcuts_backend.cc |
diff --git a/chrome/browser/autocomplete/shortcuts_backend.cc b/chrome/browser/autocomplete/shortcuts_backend.cc |
index 15e8bba32175e4fa43566fad634019562c269c9a..a7f6522d754bda06b6e89f3d3d1fa8ea1135d88e 100644 |
--- a/chrome/browser/autocomplete/shortcuts_backend.cc |
+++ b/chrome/browser/autocomplete/shortcuts_backend.cc |
@@ -28,6 +28,7 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_details.h" |
#include "content/public/browser/notification_source.h" |
+#include "extensions/browser/extension_registry.h" |
#include "extensions/common/extension.h" |
using content::BrowserThread; |
@@ -73,6 +74,7 @@ AutocompleteMatch::Type GetTypeForShortcut(AutocompleteMatch::Type type) { |
ShortcutsBackend::ShortcutsBackend(Profile* profile, bool suppress_db) |
: profile_(profile), |
current_state_(NOT_INITIALIZED), |
+ extension_registry_observer_(this), |
no_db_access_(suppress_db) { |
if (!suppress_db) { |
db_ = new history::ShortcutsDatabase( |
@@ -80,9 +82,8 @@ ShortcutsBackend::ShortcutsBackend(Profile* profile, bool suppress_db) |
} |
// |profile| can be NULL in tests. |
if (profile) { |
- notification_registrar_.Add( |
- this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
- content::Source<Profile>(profile)); |
+ extension_registry_observer_.Add( |
+ extensions::ExtensionRegistry::Get(profile)); |
Peter Kasting
2014/05/12 19:46:55
Nit: Move this after the line below, to keep initi
limasdf
2014/05/13 14:38:44
Done.
|
notification_registrar_.Add( |
this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
content::Source<Profile>(profile)); |
@@ -164,20 +165,21 @@ void ShortcutsBackend::ShutdownOnUIThread() { |
notification_registrar_.RemoveAll(); |
} |
-void ShortcutsBackend::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
+void ShortcutsBackend::OnExtensionUnloaded( |
Peter Kasting
2014/05/12 19:46:55
Nit: Function definition order should match declar
limasdf
2014/05/13 14:38:44
Done.
|
+ content::BrowserContext* browser_context, |
+ const extensions::Extension* extension, |
+ extensions::UnloadedExtensionInfo::Reason reason) { |
if (!initialized()) |
return; |
- if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { |
- // When an extension is unloaded, we want to remove any Shortcuts associated |
- // with it. |
- DeleteShortcutsWithURL(content::Details<extensions::UnloadedExtensionInfo>( |
- details)->extension->url(), false); |
- return; |
- } |
+ // When an extension is unloaded, we want to remove any Shortcuts associated |
+ // with it. |
+ DeleteShortcutsWithURL(extension->url(), false); |
+} |
+void ShortcutsBackend::Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) { |
DCHECK_EQ(chrome::NOTIFICATION_HISTORY_URLS_DELETED, type); |
const history::URLsDeletedDetails* deleted_details = |
content::Details<const history::URLsDeletedDetails>(details).ptr(); |