| Index: chrome/browser/profiles/profile_manager.cc
|
| ===================================================================
|
| --- chrome/browser/profiles/profile_manager.cc (revision 150342)
|
| +++ chrome/browser/profiles/profile_manager.cc (working copy)
|
| @@ -26,6 +26,7 @@
|
| #include "chrome/browser/profiles/profile_destroyer.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_metrics.h"
|
| +#include "chrome/browser/profiles/profile_shortcut_manager.h"
|
| #include "chrome/browser/sessions/session_service_factory.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| @@ -269,10 +270,6 @@
|
| }
|
|
|
| ProfileManager::~ProfileManager() {
|
| -#if defined(OS_WIN)
|
| - if (profile_shortcut_manager_.get())
|
| - profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get());
|
| -#endif
|
| }
|
|
|
| FilePath ProfileManager::GetDefaultProfileDir(
|
| @@ -454,6 +451,14 @@
|
| cache.AddProfileToCache(profile_path, name, string16(), icon_index);
|
| }
|
| info->callbacks.push_back(callback);
|
| + if (!name.empty() && !icon_url.empty()) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::FILE, FROM_HERE,
|
| + base::Bind(&ProfileShortcutManager::CreateChromeDesktopShortcut,
|
| + profile_path, name,
|
| + ResourceBundle::GetSharedInstance().GetNativeImageNamed(
|
| + cache.GetDefaultAvatarIconResourceIDAtIndex(icon_index))));
|
| + }
|
| }
|
| }
|
|
|
| @@ -673,9 +678,6 @@
|
| InitProfileUserPrefs(profile);
|
| AddProfileToCache(profile);
|
| DoFinalInitLogging(profile);
|
| -#if defined(OS_WIN)
|
| - CreateDesktopShortcut(profile);
|
| -#endif
|
|
|
| ProfileMetrics::LogNumberOfProfiles(this, ProfileMetrics::ADD_PROFILE_EVENT);
|
| content::NotificationService::current()->Notify(
|
| @@ -725,12 +727,6 @@
|
| Profile::CREATE_MODE_ASYNCHRONOUS);
|
| }
|
|
|
| -#if defined(OS_WIN)
|
| -ProfileShortcutManagerWin* ProfileManager::CreateShortcutManager() {
|
| - return new ProfileShortcutManagerWin();
|
| -}
|
| -#endif
|
| -
|
| void ProfileManager::OnProfileCreated(Profile* profile,
|
| bool success,
|
| bool is_new_profile) {
|
| @@ -831,16 +827,6 @@
|
| if (!profile_info_cache_.get()) {
|
| profile_info_cache_.reset(new ProfileInfoCache(
|
| g_browser_process->local_state(), user_data_dir_));
|
| -#if defined(OS_WIN)
|
| - BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| - ProfileShortcutManagerWin* shortcut_manager = CreateShortcutManager();
|
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| - if (dist && dist->CanCreateDesktopShortcuts() && shortcut_manager &&
|
| - !command_line.HasSwitch(switches::kDisableDesktopShortcuts)) {
|
| - profile_shortcut_manager_.reset(shortcut_manager);
|
| - profile_info_cache_->AddObserver(profile_shortcut_manager_.get());
|
| - }
|
| -#endif
|
| }
|
| return *profile_info_cache_.get();
|
| }
|
| @@ -870,28 +856,6 @@
|
| icon_index);
|
| }
|
|
|
| -#if defined(OS_WIN)
|
| -void ProfileManager::CreateDesktopShortcut(Profile* profile) {
|
| - // TODO(sail): Disable creating new shortcuts for now.
|
| - return;
|
| -
|
| - // Some distributions and tests cannot create desktop shortcuts, in which case
|
| - // profile_shortcut_manager_ will not be set.
|
| - if (!profile_shortcut_manager_.get())
|
| - return;
|
| -
|
| - bool shortcut_created =
|
| - profile->GetPrefs()->GetBoolean(prefs::kProfileShortcutCreated);
|
| - if (!shortcut_created && GetNumberOfProfiles() > 1) {
|
| - profile_shortcut_manager_->AddProfileShortcut(profile->GetPath());
|
| -
|
| - // We only ever create the shortcut for a profile once, so set a pref
|
| - // reminding us to skip this in the future.
|
| - profile->GetPrefs()->SetBoolean(prefs::kProfileShortcutCreated, true);
|
| - }
|
| -}
|
| -#endif
|
| -
|
| void ProfileManager::InitProfileUserPrefs(Profile* profile) {
|
| ProfileInfoCache& cache = GetProfileInfoCache();
|
|
|
| @@ -982,6 +946,9 @@
|
| QueueProfileDirectoryForDeletion(profile_dir);
|
| cache.DeleteProfileFromCache(profile_dir);
|
|
|
| + // Delete possible shortcuts for this profile
|
| + ProfileShortcutManager::DeleteChromeDesktopShortcut(profile_dir);
|
| +
|
| ProfileMetrics::LogNumberOfProfiles(this,
|
| ProfileMetrics::DELETE_PROFILE_EVENT);
|
| }
|
|
|