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

Unified Diff: chrome/browser/background_application_list_model.cc

Issue 5908003: Added Background Application entries to Dock menu (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: First round of code review follow-up Created 10 years 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 side-by-side diff with in-line comments
Download patch
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);
« chrome/browser/app_controller_mac.mm ('K') | « chrome/browser/app_controller_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698