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

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

Issue 7155015: Store profile avatar to preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
===================================================================
--- chrome/browser/profiles/profile_manager.cc (revision 91576)
+++ chrome/browser/profiles/profile_manager.cc (working copy)
@@ -25,6 +25,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "content/browser/browser_thread.h"
#include "content/common/notification_service.h"
#include "content/common/notification_type.h"
@@ -51,11 +52,10 @@
class NewProfileLauncher : public ProfileManagerObserver {
public:
virtual void OnProfileCreated(Profile* profile) {
- Browser::NewWindowWithProfile(profile);
- ProfileSyncService* service = profile->GetProfileSyncService();
- DCHECK(service);
- service->ShowLoginDialog();
- ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_PROFILE_MENU);
+ Browser* browser = Browser::Create(profile);
+ browser->AddSelectedTabWithURL(GURL(chrome::kChromeUINewProfile),
+ PageTransition::LINK);
+ browser->window()->Show();
}
virtual bool DeleteAfterCreation() OVERRIDE { return true; }
@@ -369,6 +369,8 @@
if (!command_line.HasSwitch(switches::kDisableWebResources))
profile->InitPromoResources();
+
+ AddProfileToCache(profile);
}
void ProfileManager::OnProfileCreated(Profile* profile, bool success) {
@@ -513,3 +515,23 @@
}
return *profile_info_cache_.get();
}
+
+void ProfileManager::AddProfileToCache(Profile* profile) {
+ ProfileInfoCache& cache = GetProfileInfoCache();
+ if (profile->GetPath().DirName() != cache.GetUserDataDir())
+ return;
+
+ if (cache.GetIndexOfProfileWithPath(profile->GetPath()) != std::string::npos)
+ return;
+
+ if (profile->GetPath() == GetDefaultProfileDir(cache.GetUserDataDir())) {
+ cache.AddProfileToCache(
+ profile->GetPath(),
+ l10n_util::GetStringUTF16(IDS_DEFAULT_PROFILE_NAME), 0);
+ } else {
+ cache.AddProfileToCache(
+ profile->GetPath(),
+ cache.ChooseNameForNewProfile(),
+ cache.ChooseAvatarIconIndexForNewProfile());
+ }
+}
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698