Index: chrome/browser/ui/app_list/app_list_syncable_service.cc |
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc |
index b62e7b223010496ad3bc7d02d747185d3dfe6f1d..fd058dab86fc62e20f47054eb9354b765c43368f 100644 |
--- a/chrome/browser/ui/app_list/app_list_syncable_service.cc |
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc |
@@ -4,17 +4,36 @@ |
#include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
+#include "chrome/browser/chrome_notification_types.h" |
+#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/app_list/app_list_service.h" |
#include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
#include "chrome/browser/ui/host_desktop.h" |
+#include "content/public/browser/notification_source.h" |
#include "ui/app_list/app_list_model.h" |
namespace app_list { |
-AppListSyncableService::AppListSyncableService(Profile* profile) |
+AppListSyncableService::AppListSyncableService( |
+ Profile* profile, |
+ ExtensionService* extension_service) |
: profile_(profile), |
model_(new AppListModel) { |
+ if (extension_service && extension_service->is_ready()) { |
+ BuildModel(); |
+ return; |
+ } |
+ |
+ // The extensions for this profile have not yet all been loaded. |
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
+ content::Source<Profile>(profile)); |
+} |
+ |
+AppListSyncableService::~AppListSyncableService() { |
+} |
+ |
+void AppListSyncableService::BuildModel() { |
// For now, use the AppListControllerDelegate associated with the native |
// desktop. TODO(stevenjb): Remove ExtensionAppModelBuilder controller |
// dependency and move the dependent methods from AppListControllerDelegate |
@@ -30,7 +49,14 @@ AppListSyncableService::AppListSyncableService(Profile* profile) |
VLOG(1) << "AppListSyncableService Created."; |
} |
-AppListSyncableService::~AppListSyncableService() { |
+void AppListSyncableService::Observe( |
+ int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) { |
+ DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
+ DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
+ registrar_.RemoveAll(); |
+ BuildModel(); |
} |
} // namespace app_list |