| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/profiles/profiles_state.h" | 5 #include "chrome/browser/profiles/profiles_state.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | |
| 16 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 15 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 17 #include "chrome/browser/profiles/gaia_info_update_service.h" | 16 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 18 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" | 17 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_attributes_entry.h" | 19 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| 21 #include "chrome/browser/profiles/profile_attributes_storage.h" | 20 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 24 #include "chrome/browser/signin/signin_error_controller_factory.h" | 23 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 25 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
| 29 #include "components/prefs/pref_registry_simple.h" | 28 #include "components/prefs/pref_registry_simple.h" |
| 30 #include "components/prefs/pref_service.h" | 29 #include "components/prefs/pref_service.h" |
| 31 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 30 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 32 #include "components/signin/core/common/signin_pref_names.h" | 31 #include "components/signin/core/common/signin_pref_names.h" |
| 32 #include "content/public/browser/browsing_data_remover.h" |
| 33 #include "content/public/browser/resource_dispatcher_host.h" | 33 #include "content/public/browser/resource_dispatcher_host.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/gfx/text_elider.h" | 35 #include "ui/gfx/text_elider.h" |
| 36 | 36 |
| 37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 38 #include "chromeos/login/login_state.h" | 38 #include "chromeos/login/login_state.h" |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace profiles { | 41 namespace profiles { |
| 42 | 42 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( | 229 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( |
| 230 profile_path); | 230 profile_path); |
| 231 if (!profile) | 231 if (!profile) |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 // For guest profiles the browsing data is in the OTR profile. | 234 // For guest profiles the browsing data is in the OTR profile. |
| 235 if (profile->IsGuestSession()) | 235 if (profile->IsGuestSession()) |
| 236 profile = profile->GetOffTheRecordProfile(); | 236 profile = profile->GetOffTheRecordProfile(); |
| 237 | 237 |
| 238 BrowsingDataRemoverFactory::GetForBrowserContext(profile)->Remove( | 238 content::BrowserContext::GetBrowsingDataRemover(profile)->Remove( |
| 239 base::Time(), base::Time::Max(), | 239 base::Time(), base::Time::Max(), |
| 240 ChromeBrowsingDataRemoverDelegate::WIPE_PROFILE, | 240 ChromeBrowsingDataRemoverDelegate::WIPE_PROFILE, |
| 241 ChromeBrowsingDataRemoverDelegate::ALL_ORIGIN_TYPES); | 241 ChromeBrowsingDataRemoverDelegate::ALL_ORIGIN_TYPES); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void SetLastUsedProfile(const std::string& profile_dir) { | 244 void SetLastUsedProfile(const std::string& profile_dir) { |
| 245 // We should never be saving the System Profile as the last one used since it | 245 // We should never be saving the System Profile as the last one used since it |
| 246 // shouldn't have a browser. | 246 // shouldn't have a browser. |
| 247 if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) | 247 if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) |
| 248 return; | 248 return; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 276 bool IsPublicSession() { | 276 bool IsPublicSession() { |
| 277 #if defined(OS_CHROMEOS) | 277 #if defined(OS_CHROMEOS) |
| 278 if (chromeos::LoginState::IsInitialized()) { | 278 if (chromeos::LoginState::IsInitialized()) { |
| 279 return chromeos::LoginState::Get()->IsPublicSessionUser(); | 279 return chromeos::LoginState::Get()->IsPublicSessionUser(); |
| 280 } | 280 } |
| 281 #endif | 281 #endif |
| 282 return false; | 282 return false; |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace profiles | 285 } // namespace profiles |
| OLD | NEW |