Chromium Code Reviews| 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..63a07faab1329ee61b60ba85c412306702401974 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) |
|
sail
2013/06/14 17:15:39
The profile icon code doesn't really belong in thi
calamity
2013/06/17 07:29:30
Any suggestions about where to put it then?
I had
sail
2013/06/17 19:51:03
ProfileManager is not correct either.
How about l
calamity
2013/06/18 04:41:30
Listened for notification from profile_shortcut_ma
|
| + 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->CreateOrUpdateProfileIcon( |
| + 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); |