OLD | NEW |
---|---|
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
45 #include "net/http/http_transaction_factory.h" | 45 #include "net/http/http_transaction_factory.h" |
46 #include "net/url_request/url_request_context.h" | 46 #include "net/url_request/url_request_context.h" |
47 #include "net/url_request/url_request_context_getter.h" | 47 #include "net/url_request/url_request_context_getter.h" |
48 #include "net/url_request/url_request_job.h" | 48 #include "net/url_request/url_request_job.h" |
49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
50 | 50 |
51 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
52 #include "chrome/browser/chromeos/cros/cros_library.h" | 52 #include "chrome/browser/chromeos/cros/cros_library.h" |
53 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 53 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
54 #include "chrome/browser/chromeos/login/user_manager.h" | |
54 #endif | 55 #endif |
55 | 56 |
56 using content::BrowserThread; | 57 using content::BrowserThread; |
57 using content::UserMetricsAction; | 58 using content::UserMetricsAction; |
58 | 59 |
59 namespace { | 60 namespace { |
60 | 61 |
61 // Profiles that should be deleted on shutdown. | 62 // Profiles that should be deleted on shutdown. |
62 std::vector<FilePath>& ProfilesToDelete() { | 63 std::vector<FilePath>& ProfilesToDelete() { |
63 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); | 64 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 ProfilesToDelete().clear(); | 177 ProfilesToDelete().clear(); |
177 } | 178 } |
178 | 179 |
179 // static | 180 // static |
180 Profile* ProfileManager::GetDefaultProfile() { | 181 Profile* ProfileManager::GetDefaultProfile() { |
181 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 182 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
182 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); | 183 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); |
183 } | 184 } |
184 | 185 |
185 // static | 186 // static |
187 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() { | |
Nikita (slow)
2012/03/19 10:50:46
I see this method as a temporary measure as we cou
Jun Mukai
2012/03/19 11:00:59
Done.
| |
188 Profile* profile = GetDefaultProfile(); | |
189 #if defined(OS_CHROMEOS) | |
190 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) | |
191 profile = profile->GetOffTheRecordProfile(); | |
192 #endif | |
193 return profile; | |
194 } | |
195 | |
196 // static | |
186 Profile* ProfileManager::GetLastUsedProfile() { | 197 Profile* ProfileManager::GetLastUsedProfile() { |
187 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 198 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
188 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_); | 199 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_); |
189 } | 200 } |
190 | 201 |
191 // static | 202 // static |
192 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() { | 203 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() { |
193 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 204 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
194 return profile_manager->GetLastOpenedProfiles( | 205 return profile_manager->GetLastOpenedProfiles( |
195 profile_manager->user_data_dir_); | 206 profile_manager->user_data_dir_); |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 AddProfileToCache(profile); | 955 AddProfileToCache(profile); |
945 } | 956 } |
946 } | 957 } |
947 | 958 |
948 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 959 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
949 Profile* profile, | 960 Profile* profile, |
950 Profile::CreateStatus status) { | 961 Profile::CreateStatus status) { |
951 for (size_t i = 0; i < callbacks.size(); ++i) | 962 for (size_t i = 0; i < callbacks.size(); ++i) |
952 callbacks[i].Run(profile, status); | 963 callbacks[i].Run(profile, status); |
953 } | 964 } |
OLD | NEW |