| Index: chrome/browser/profiles/profile_impl.cc
|
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
|
| index 6b8fa17a0ac89e8ed8edf00d2aaffffc06d552b9..c6d3904b12e63b9575b7f842768c0c5556887834 100644
|
| --- a/chrome/browser/profiles/profile_impl.cc
|
| +++ b/chrome/browser/profiles/profile_impl.cc
|
| @@ -159,6 +159,10 @@ static const char kReadmeText[] =
|
| const char* const kPrefExitTypeCrashed = "Crashed";
|
| const char* const kPrefExitTypeSessionEnded = "SessionEnded";
|
|
|
| +#if defined(OS_WIN)
|
| +const int kCurrentProfileIconVersion = 1;
|
| +#endif
|
| +
|
| // Helper method needed because PostTask cannot currently take a Callback
|
| // function with non-void return type.
|
| void CreateDirectoryAndSignal(const base::FilePath& path,
|
| @@ -354,7 +358,8 @@ ProfileImpl::ProfileImpl(
|
| last_session_exit_type_(EXIT_NORMAL),
|
| start_time_(Time::Now()),
|
| delegate_(delegate),
|
| - predictor_(NULL) {
|
| + predictor_(NULL),
|
| + weak_ptr_factory_(this) {
|
| DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
|
| "profile files to the root directory!";
|
|
|
| @@ -733,6 +738,9 @@ void ProfileImpl::OnPrefsLoaded(bool success) {
|
| // Force this to true in case we fallback and use it.
|
| // TODO(sky): remove this in a couple of releases (m28ish).
|
| prefs_->SetBoolean(prefs::kSessionExitedCleanly, true);
|
| +#if defined(OS_WIN)
|
| + UpdateProfileIconIfNecessary();
|
| +#endif
|
|
|
| BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
| this, false);
|
| @@ -747,6 +755,25 @@ void ProfileImpl::OnPrefsLoaded(bool success) {
|
| DoFinalInit();
|
| }
|
|
|
| +void ProfileImpl::UpdateProfileIconIfNecessary() {
|
| + if (prefs_->GetInteger(prefs::kProfileIconVersion) <
|
| + kCurrentProfileIconVersion) {
|
| + // Ensure the profile's icon file has been created.
|
| + ProfileShortcutManager* profile_shortcut_manager =
|
| + g_browser_process->profile_manager()->profile_shortcut_manager();
|
| + if (profile_shortcut_manager) {
|
| + profile_shortcut_manager->CreateProfileIcon(
|
| + GetPath(),
|
| + base::Bind(&ProfileImpl::OnProfileIconCreateSuccess,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| + }
|
| + }
|
| +}
|
| +
|
| +void ProfileImpl::OnProfileIconCreateSuccess() {
|
| + prefs_->SetInteger(prefs::kProfileIconVersion, kCurrentProfileIconVersion);
|
| +}
|
| +
|
| bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
|
| Version profile_version(ChromeVersionService::GetVersion(prefs_.get()));
|
| Version arg_version(version);
|
|
|