OLD | NEW |
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_util.h" | 10 #include "base/file_util.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/sessions/session_service_factory.h" |
14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/logging_chrome.h" | 20 #include "chrome/common/logging_chrome.h" |
20 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
21 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
22 #include "content/common/notification_type.h" | 23 #include "content/common/notification_type.h" |
23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 64 |
64 } // namespace | 65 } // namespace |
65 | 66 |
66 // static | 67 // static |
67 void ProfileManager::ShutdownSessionServices() { | 68 void ProfileManager::ShutdownSessionServices() { |
68 ProfileManager* pm = g_browser_process->profile_manager(); | 69 ProfileManager* pm = g_browser_process->profile_manager(); |
69 if (!pm) // Is NULL when running unit tests. | 70 if (!pm) // Is NULL when running unit tests. |
70 return; | 71 return; |
71 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); | 72 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); |
72 for (size_t i = 0; i < profiles.size(); ++i) | 73 for (size_t i = 0; i < profiles.size(); ++i) |
73 profiles[i]->ShutdownSessionService(); | 74 SessionServiceFactory::ShutdownForProfile(profiles[i]); |
74 } | 75 } |
75 | 76 |
76 // static | 77 // static |
77 Profile* ProfileManager::GetDefaultProfile() { | 78 Profile* ProfileManager::GetDefaultProfile() { |
78 FilePath user_data_dir; | 79 FilePath user_data_dir; |
79 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 80 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
80 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 81 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
81 return profile_manager->GetDefaultProfile(user_data_dir); | 82 return profile_manager->GetDefaultProfile(user_data_dir); |
82 } | 83 } |
83 | 84 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 #endif | 392 #endif |
392 } else { | 393 } else { |
393 profile = NULL; | 394 profile = NULL; |
394 profiles_info_.erase(iter); | 395 profiles_info_.erase(iter); |
395 } | 396 } |
396 | 397 |
397 for (size_t i = 0; i < observers.size(); ++i) { | 398 for (size_t i = 0; i < observers.size(); ++i) { |
398 observers[i]->OnProfileCreated(profile); | 399 observers[i]->OnProfileCreated(profile); |
399 } | 400 } |
400 } | 401 } |
OLD | NEW |