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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 10837352: Update profile desktop shortcuts (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 this, 263 this,
264 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 264 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
265 content::NotificationService::AllSources()); 265 content::NotificationService::AllSources());
266 registrar_.Add( 266 registrar_.Add(
267 this, 267 this,
268 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 268 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
269 content::NotificationService::AllSources()); 269 content::NotificationService::AllSources());
270 270
271 if (ProfileShortcutManager::IsFeatureEnabled()) 271 if (ProfileShortcutManager::IsFeatureEnabled())
272 profile_shortcut_manager_.reset(ProfileShortcutManager::Create()); 272 profile_shortcut_manager_.reset(ProfileShortcutManager::Create());
273 GetProfileInfoCache().AddObserver(profile_shortcut_manager_.get());
sail 2012/08/21 21:59:26 Another way to do this would be to have ProfileSho
Halli 2012/08/23 17:59:20 Done.
273 } 274 }
274 275
275 ProfileManager::~ProfileManager() { 276 ProfileManager::~ProfileManager() {
276 } 277 }
277 278
278 FilePath ProfileManager::GetDefaultProfileDir( 279 FilePath ProfileManager::GetDefaultProfileDir(
279 const FilePath& user_data_dir) { 280 const FilePath& user_data_dir) {
280 FilePath default_profile_dir(user_data_dir); 281 FilePath default_profile_dir(user_data_dir);
281 default_profile_dir = 282 default_profile_dir =
282 default_profile_dir.AppendASCII(chrome::kInitialProfile); 283 default_profile_dir.AppendASCII(chrome::kInitialProfile);
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 BrowserList::CloseAllBrowsersWithProfile(profile); 948 BrowserList::CloseAllBrowsersWithProfile(profile);
948 949
949 // Disable sync for doomed profile. 950 // Disable sync for doomed profile.
950 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( 951 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
951 profile)) { 952 profile)) {
952 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 953 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
953 profile)->DisableForUser(); 954 profile)->DisableForUser();
954 } 955 }
955 } 956 }
956 957
958 // Delete possible shortcuts for this profile
959 if (profile_shortcut_manager_.get())
960 profile_shortcut_manager_->DeleteChromeDesktopShortcut(
961 profile_dir, cache.GetNameOfProfileAtIndex(
962 cache.GetIndexOfProfileWithPath(profile_dir)));
963
957 QueueProfileDirectoryForDeletion(profile_dir); 964 QueueProfileDirectoryForDeletion(profile_dir);
958 cache.DeleteProfileFromCache(profile_dir); 965 cache.DeleteProfileFromCache(profile_dir);
959 966
960 // Delete possible shortcuts for this profile
961 if (profile_shortcut_manager_.get())
962 profile_shortcut_manager_->DeleteChromeDesktopShortcut(profile_dir);
963
964 ProfileMetrics::LogNumberOfProfiles(this, 967 ProfileMetrics::LogNumberOfProfiles(this,
965 ProfileMetrics::DELETE_PROFILE_EVENT); 968 ProfileMetrics::DELETE_PROFILE_EVENT);
966 } 969 }
967 970
968 // static 971 // static
969 bool ProfileManager::IsMultipleProfilesEnabled() { 972 bool ProfileManager::IsMultipleProfilesEnabled() {
970 #if defined(OS_CHROMEOS) 973 #if defined(OS_CHROMEOS)
971 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) 974 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles))
972 return false; 975 return false;
973 #endif 976 #endif
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 } 1017 }
1015 1018
1016 ProfileManager::ProfileInfo::ProfileInfo(Profile* profile, bool created) 1019 ProfileManager::ProfileInfo::ProfileInfo(Profile* profile, bool created)
1017 : profile(profile), 1020 : profile(profile),
1018 created(created) { 1021 created(created) {
1019 } 1022 }
1020 1023
1021 ProfileManager::ProfileInfo::~ProfileInfo() { 1024 ProfileManager::ProfileInfo::~ProfileInfo() {
1022 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1025 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1023 } 1026 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698