No longer start BG mode until a BackgroundContents is loaded

BUG=120448
TEST=Install hosted app, ensure it does not kick off background mode until it opens a background contents via JS.


Review URL: http://codereview.chromium.org/10298002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135264 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h
index 10b7677b..7232cce 100644
--- a/chrome/browser/background/background_contents_service.h
+++ b/chrome/browser/background/background_contents_service.h
@@ -53,6 +53,12 @@
   // or NULL if none.
   BackgroundContents* GetAppBackgroundContents(const string16& appid);
 
+  // Returns true if there's a registered BackgroundContents for this app. It
+  // is possible for this routine to return true when GetAppBackgroundContents()
+  // returns false, if the BackgroundContents closed due to the render process
+  // crashing.
+  bool HasRegisteredBackgroundContents(const string16& appid);
+
   // Returns all currently opened BackgroundContents (used by the task manager).
   std::vector<BackgroundContents*> GetBackgroundContents() const;
 
@@ -152,6 +158,11 @@
   // Returns true if this BackgroundContents is in the contents_list_.
   bool IsTracked(BackgroundContents* contents) const;
 
+  // Sends out a notification when our association of background contents with
+  // apps may have changed (used by BackgroundApplicationListModel to update the
+  // set of background apps as new background contents are opened/closed).
+  void SendChangeNotification(Profile* profile);
+
   // PrefService used to store list of background pages (or NULL if this is
   // running under an incognito profile).
   PrefService* prefs_;