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

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: Added TODO for mocking BackgroundApplicationListModel 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
« no previous file with comments | « chrome/browser/app_controller_mac_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4a2a617af027c582124f181ba954df79b2048ce1..eac257761222cd9573ec4ca93fd67a9c56fecbf0 100644
--- a/chrome/browser/background_application_list_model.cc
+++ b/chrome/browser/background_application_list_model.cc
@@ -10,6 +10,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"
@@ -157,6 +158,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) {
@@ -168,6 +172,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);
« no previous file with comments | « chrome/browser/app_controller_mac_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698