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

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

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
19 #include "chrome/browser/sessions/session_service_factory.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/logging_chrome.h" 25 #include "chrome/common/logging_chrome.h"
25 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
26 #include "content/browser/browser_thread.h" 27 #include "content/browser/browser_thread.h"
27 #include "content/common/notification_service.h" 28 #include "content/common/notification_service.h"
28 #include "content/common/notification_type.h" 29 #include "content/common/notification_type.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 virtual bool DeleteAfterCreation() OVERRIDE { return true; } 87 virtual bool DeleteAfterCreation() OVERRIDE { return true; }
87 }; 88 };
88 89
89 // static 90 // static
90 void ProfileManager::ShutdownSessionServices() { 91 void ProfileManager::ShutdownSessionServices() {
91 ProfileManager* pm = g_browser_process->profile_manager(); 92 ProfileManager* pm = g_browser_process->profile_manager();
92 if (!pm) // Is NULL when running unit tests. 93 if (!pm) // Is NULL when running unit tests.
93 return; 94 return;
94 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); 95 std::vector<Profile*> profiles(pm->GetLoadedProfiles());
95 for (size_t i = 0; i < profiles.size(); ++i) 96 for (size_t i = 0; i < profiles.size(); ++i)
96 profiles[i]->ShutdownSessionService(); 97 SessionServiceFactory::ShutdownForProfile(profiles[i]);
97 } 98 }
98 99
99 // static 100 // static
100 Profile* ProfileManager::GetDefaultProfile() { 101 Profile* ProfileManager::GetDefaultProfile() {
101 FilePath user_data_dir; 102 FilePath user_data_dir;
102 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 103 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
103 ProfileManager* profile_manager = g_browser_process->profile_manager(); 104 ProfileManager* profile_manager = g_browser_process->profile_manager();
104 return profile_manager->GetDefaultProfile(user_data_dir); 105 return profile_manager->GetDefaultProfile(user_data_dir);
105 } 106 }
106 107
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 NewProfileLauncher* launcher = new NewProfileLauncher(); 496 NewProfileLauncher* launcher = new NewProfileLauncher();
496 profile_manager->CreateProfileAsync(new_path, launcher); 497 profile_manager->CreateProfileAsync(new_path, launcher);
497 } 498 }
498 499
499 // static 500 // static
500 void ProfileManager::RegisterPrefs(PrefService* prefs) { 501 void ProfileManager::RegisterPrefs(PrefService* prefs) {
501 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); 502 prefs->RegisterStringPref(prefs::kProfileLastUsed, "");
502 prefs->RegisterDictionaryPref(prefs::kProfileDirectoryMap); 503 prefs->RegisterDictionaryPref(prefs::kProfileDirectoryMap);
503 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); 504 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
504 } 505 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/sessions/base_session_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698