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

Unified Diff: chrome/browser/background/background_mode_manager.cc

Issue 10298002: No longer start BG mode until a BackgroundContents is loaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed up unit tests to not be racey. Created 8 years, 8 months 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/background_mode_manager.cc
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index e21c5728641fa291946e630cfcff80c363830eac..98a9c33833a3c3583a6f73b2c5eb6defca227665 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -263,6 +263,10 @@ void BackgroundModeManager::LaunchBackgroundApplication(
NEW_FOREGROUND_TAB);
}
+bool BackgroundModeManager::IsBackgroundModeActiveForTest() {
+ return in_background_mode_;
+}
+
int BackgroundModeManager::NumberOfBackgroundModeData() {
return background_mode_data_.size();
}
@@ -290,10 +294,11 @@ void BackgroundModeManager::Observe(
case chrome::NOTIFICATION_EXTENSION_LOADED: {
Extension* extension = content::Details<Extension>(details).ptr();
- if (BackgroundApplicationListModel::IsBackgroundApp(*extension)) {
+ Profile* profile = content::Source<Profile>(source).ptr();
+ if (BackgroundApplicationListModel::IsBackgroundApp(
+ *extension, profile)) {
// Extensions loaded after the ExtensionsService is ready should be
// treated as new installs.
- Profile* profile = content::Source<Profile>(source).ptr();
if (profile->GetExtensionService()->is_ready())
OnBackgroundAppInstalled(extension);
}
@@ -537,6 +542,12 @@ void BackgroundModeManager::StartBackgroundMode() {
// Display a status icon to exit Chrome.
InitStatusTrayIcon();
+
+ bool new_value = true;
Mihai Parparita -not on Chrome 2012/05/03 19:32:35 Why not use &in_background_mode_?
Andrew T Wilson (Slow) 2012/05/03 21:36:58 Good idea - heh, the dangers of writing code too l
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_BACKGROUND_MODE_CHANGED,
+ content::Source<BackgroundModeManager>(this),
+ content::Details<bool>(&new_value));
}
void BackgroundModeManager::InitStatusTrayIcon() {
@@ -556,6 +567,11 @@ void BackgroundModeManager::EndBackgroundMode() {
BrowserList::EndKeepAlive();
RemoveStatusTrayIcon();
+ bool new_value = false;
Mihai Parparita -not on Chrome 2012/05/03 19:32:35 Same here.
Andrew T Wilson (Slow) 2012/05/03 21:36:58 Done.
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_BACKGROUND_MODE_CHANGED,
+ content::Source<BackgroundModeManager>(this),
+ content::Details<bool>(&new_value));
}
void BackgroundModeManager::EnableBackgroundMode() {

Powered by Google App Engine
This is Rietveld 408576698