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

Unified Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 8840003: Replace ProfileManagerObserver with callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo 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
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/avatar_menu_model.cc
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 592f6ec055ae96204e0d293128acedfa4ba92e1a..9d1366d3ace42aceb9ee90b2d94c67b80a4bdd3f 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/profiles/avatar_menu_model.h"
+#include "base/bind.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -27,20 +28,16 @@ using content::BrowserThread;
namespace {
-class ProfileSwitchObserver : public ProfileManagerObserver {
- public:
- virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+void OnProfileCreated(Profile* profile,
+ Profile::CreateStatus status) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (status == STATUS_INITIALIZED) {
- ProfileManager::NewWindowWithProfile(profile,
- BrowserInit::IS_NOT_PROCESS_STARTUP,
- BrowserInit::IS_NOT_FIRST_RUN);
- }
+ if (status == Profile::CREATE_STATUS_INITIALIZED) {
+ ProfileManager::NewWindowWithProfile(profile,
+ BrowserInit::IS_NOT_PROCESS_STARTUP,
+ BrowserInit::IS_NOT_FIRST_RUN);
}
-
- virtual bool DeleteAfter() OVERRIDE { return true; }
-};
+}
} // namespace
@@ -78,11 +75,9 @@ AvatarMenuModel::Item::~Item() {
void AvatarMenuModel::SwitchToProfile(size_t index) {
const Item& item = GetItemAt(index);
FilePath path = profile_info_->GetPathOfProfileAtIndex(item.model_index);
-
- // This will be deleted by the manager after the profile is ready.
- ProfileSwitchObserver* observer = new ProfileSwitchObserver();
g_browser_process->profile_manager()->CreateProfileAsync(
- path, observer);
+ path, base::Bind(&OnProfileCreated));
+
ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_ICON);
}
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698