Index: chrome/browser/background_application_list_model.cc |
diff --git a/chrome/browser/background_application_list_model.cc b/chrome/browser/background_application_list_model.cc |
index 09ec5a659428d28c62ae568231769613ea1a6a0a..c50ec88284938e407fbeb995967e545d163f9747 100644 |
--- a/chrome/browser/background_application_list_model.cc |
+++ b/chrome/browser/background_application_list_model.cc |
@@ -9,6 +9,7 @@ |
#include "app/l10n_util_collator.h" |
#include "base/stl_util-inl.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/app/chrome_command_ids.h" |
#include "chrome/browser/background_mode_manager.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/extensions/extension_prefs.h" |
@@ -155,6 +156,9 @@ BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile) |
registrar_.Add(this, |
NotificationType::EXTENSIONS_READY, |
Source<Profile>(profile)); |
+ ExtensionService* service = profile->GetExtensionService(); |
+ if (service && service->is_ready()) |
+ Update(); |
} |
void BackgroundApplicationListModel::AddObserver(Observer* observer) { |
@@ -166,6 +170,13 @@ void BackgroundApplicationListModel::AssociateApplicationData( |
DCHECK(IsBackgroundApp(*extension)); |
Application* application = FindApplication(extension); |
if (!application) { |
+ // App position is used as a dynamic command and so must be less than any |
+ // predefined command id. |
+ if (applications_.size() >= IDC_MinimumLabelValue) { |
+ LOG(ERROR) << "Background application limit of " << IDC_MinimumLabelValue |
+ << " exceeded. Ignoring."; |
+ return; |
+ } |
application = new Application(this, extension); |
applications_[extension->id()] = application; |
application->RequestIcon(Extension::EXTENSION_ICON_BITTY); |