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

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

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 years, 10 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 | Annotate | Revision Log
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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/extensions/default_apps_trial.h" 19 #include "chrome/browser/extensions/default_apps_trial.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/prefs/pref_service.h" 21 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" 22 #include "chrome/browser/prefs/scoped_user_pref_update.h"
23 #include "chrome/browser/profiles/profile_info_cache.h" 23 #include "chrome/browser/profiles/profile_info_cache.h"
24 #include "chrome/browser/profiles/profile_metrics.h" 24 #include "chrome/browser/profiles/profile_metrics.h"
25 #include "chrome/browser/sessions/session_service_factory.h" 25 #include "chrome/browser/sessions/session_service_factory.h"
26 #include "chrome/browser/sync/profile_sync_service.h" 26 #include "chrome/browser/sync/profile_sync_service.h"
27 #include "chrome/browser/sync/profile_sync_service_factory.h"
27 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 30 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
30 #include "chrome/common/chrome_constants.h" 31 #include "chrome/common/chrome_constants.h"
31 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/logging_chrome.h" 34 #include "chrome/common/logging_chrome.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
36 #if defined(OS_WIN) 37 #if defined(OS_WIN)
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 815 }
815 } 816 }
816 817
817 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we 818 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we
818 // start deleting the profile instance we need to close background apps too. 819 // start deleting the profile instance we need to close background apps too.
819 Profile* profile = GetProfileByPath(profile_dir); 820 Profile* profile = GetProfileByPath(profile_dir);
820 if (profile) { 821 if (profile) {
821 BrowserList::CloseAllBrowsersWithProfile(profile); 822 BrowserList::CloseAllBrowsersWithProfile(profile);
822 823
823 // Disable sync for doomed profile. 824 // Disable sync for doomed profile.
824 if (profile->HasProfileSyncService()) 825 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
825 profile->GetProfileSyncService()->DisableForUser(); 826 profile)) {
827 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
828 profile)->DisableForUser();
829 }
826 } 830 }
827 831
828 QueueProfileDirectoryForDeletion(profile_dir); 832 QueueProfileDirectoryForDeletion(profile_dir);
829 cache.DeleteProfileFromCache(profile_dir); 833 cache.DeleteProfileFromCache(profile_dir);
830 834
831 ProfileMetrics::LogNumberOfProfiles(this, 835 ProfileMetrics::LogNumberOfProfiles(this,
832 ProfileMetrics::DELETE_PROFILE_EVENT); 836 ProfileMetrics::DELETE_PROFILE_EVENT);
833 } 837 }
834 838
835 // static 839 // static
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); 878 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get());
875 } 879 }
876 #endif 880 #endif
877 881
878 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, 882 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks,
879 Profile* profile, 883 Profile* profile,
880 Profile::CreateStatus status) { 884 Profile::CreateStatus status) {
881 for (size_t i = 0; i < callbacks.size(); ++i) 885 for (size_t i = 0; i < callbacks.size(); ++i)
882 callbacks[i].Run(profile, status); 886 callbacks[i].Run(profile, status);
883 } 887 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webstore_private_api.cc ('k') | chrome/browser/sync/sync_setup_wizard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698