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

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

Issue 8802013: Fixing background mode manager to correctly display the name of the profile in the status icon. P... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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/background_mode_manager.h
===================================================================
--- chrome/browser/background/background_mode_manager.h (revision 111700)
+++ chrome/browser/background/background_mode_manager.h (working copy)
@@ -11,6 +11,7 @@
#include "base/gtest_prod_util.h"
#include "chrome/browser/background/background_application_list_model.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/browser/profiles/profile_info_cache_observer.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "content/public/browser/notification_observer.h"
@@ -43,6 +44,7 @@
class BackgroundModeManager
: public content::NotificationObserver,
public BackgroundApplicationListModel::Observer,
+ public ProfileInfoCacheObserver,
public ProfileKeyedService,
public ui::SimpleMenuModel::Delegate {
public:
@@ -59,6 +61,8 @@
static bool IsBackgroundModePermanentlyDisabled(
const CommandLine* command_line);
+ ProfileInfoCache* profile_cache();
+
static void LaunchBackgroundApplication(Profile* profile,
const Extension* extension);
@@ -112,6 +116,14 @@
void BuildProfileMenu(ui::SimpleMenuModel* menu,
ui::SimpleMenuModel* containing_menu);
+ // Set the name associated with this background mode data for displaying in
+ // the status tray.
+ void SetName(const string16& new_profile_name);
+
+ // The name associated with this background mode data. This should match
+ // the name in the ProfileInfoCache for this profile.
+ string16 name();
+
// Used for sorting BackgroundModeData*s.
static bool BackgroundModeDataCompare(const BackgroundModeData* bmd1,
const BackgroundModeData* bmd2);
@@ -139,6 +151,8 @@
// which is similar to a shared_ptr.
typedef linked_ptr<BackgroundModeData> BackgroundModeInfo;
+ typedef std::map<Profile*, BackgroundModeInfo> BackgroundModeInfoMap;
+
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -149,6 +163,13 @@
Profile* profile) OVERRIDE;
virtual void OnApplicationListChanged(Profile* profile) OVERRIDE;
+ // Overrides from ProfileInfoCacheObserver
+ virtual void OnProfileAdded(const string16& profile_name,
+ const string16& profile_base_dir) OVERRIDE;
+ virtual void OnProfileRemoved(const string16& profile_name) OVERRIDE;
+ virtual void OnProfileNameChanged(const string16& old_profile_name,
+ const string16& new_profile_name) OVERRIDE;
+
// Overrides from SimpleMenuModel::Delegate implementation.
virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
@@ -211,6 +232,11 @@
BackgroundModeManager::BackgroundModeData* GetBackgroundModeData(
Profile* const profile) const;
+ // Returns the iterator associated with a particular profile name.
+ // If it does not exist, returns NULL.
Andrew T Wilson (Slow) 2011/12/06 00:46:03 Update this comment since this cannot return NULL.
rpetterson 2011/12/06 05:52:34 Done.
+ BackgroundModeInfoMap::const_iterator GetBackgroundModeIterator(
+ const string16& profile_name) const;
+
// Returns true if the "Let chrome run in the background" pref is checked.
// (virtual to allow overriding in tests).
virtual bool IsBackgroundModePrefEnabled() const;
@@ -237,7 +263,7 @@
PrefChangeRegistrar pref_registrar_;
// The profile-keyed data for this background mode manager. Keyed on profile.
- std::map<Profile*, BackgroundModeInfo> background_mode_data_;
+ BackgroundModeInfoMap background_mode_data_;
// Reference to our status tray. If null, the platform doesn't support status
// icons.

Powered by Google App Engine
This is Rietveld 408576698