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 "chrome/browser/profiles/profile_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
123 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 123 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
124 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 124 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
125 #include "chromeos/chromeos_switches.h" | 125 #include "chromeos/chromeos_switches.h" |
126 #include "chromeos/dbus/cryptohome_client.h" | 126 #include "chromeos/dbus/cryptohome_client.h" |
127 #include "chromeos/dbus/dbus_thread_manager.h" | 127 #include "chromeos/dbus/dbus_thread_manager.h" |
128 #include "components/user_manager/user.h" | 128 #include "components/user_manager/user.h" |
129 #include "components/user_manager/user_manager.h" | 129 #include "components/user_manager/user_manager.h" |
130 #endif | 130 #endif |
131 | 131 |
132 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 132 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
133 #include "chrome/browser/profiles/profile_statistics.h" | 133 #include "chrome/browser/profiles/profile_statistics.h" |
134 #include "chrome/browser/profiles/profile_statistics_factory.h" | 134 #include "chrome/browser/profiles/profile_statistics_factory.h" |
135 #endif | 135 #endif |
136 | 136 |
137 using base::UserMetricsAction; | 137 using base::UserMetricsAction; |
138 using content::BrowserThread; | 138 using content::BrowserThread; |
139 | 139 |
140 namespace { | 140 namespace { |
141 | 141 |
142 // Profile deletion can pass through two stages: | 142 // Profile deletion can pass through two stages: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 #if !defined(OS_ANDROID) | 330 #if !defined(OS_ANDROID) |
331 // Helper function for ScheduleForcedEphemeralProfileForDeletion. | 331 // Helper function for ScheduleForcedEphemeralProfileForDeletion. |
332 bool IsProfileEphemeral(ProfileAttributesStorage* storage, | 332 bool IsProfileEphemeral(ProfileAttributesStorage* storage, |
333 const base::FilePath& profile_dir) { | 333 const base::FilePath& profile_dir) { |
334 ProfileAttributesEntry* entry = nullptr; | 334 ProfileAttributesEntry* entry = nullptr; |
335 return storage->GetProfileAttributesWithPath(profile_dir, &entry) && | 335 return storage->GetProfileAttributesWithPath(profile_dir, &entry) && |
336 entry->IsEphemeral(); | 336 entry->IsEphemeral(); |
337 } | 337 } |
338 #endif | 338 #endif |
339 | 339 |
340 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 340 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
341 void SignOut(SigninManager* signin_manager) { | 341 void SignOut(SigninManager* signin_manager) { |
342 signin_manager->SignOut( | 342 signin_manager->SignOut( |
343 signin_metrics::AUTHENTICATION_FAILED_WITH_FORCE_SIGNIN, | 343 signin_metrics::AUTHENTICATION_FAILED_WITH_FORCE_SIGNIN, |
344 signin_metrics::SignoutDelete::IGNORE_METRIC); | 344 signin_metrics::SignoutDelete::IGNORE_METRIC); |
345 } | 345 } |
346 #endif | 346 #endif |
347 | 347 |
348 } // namespace | 348 } // namespace |
349 | 349 |
350 ProfileManager::ProfileManager(const base::FilePath& user_data_dir) | 350 ProfileManager::ProfileManager(const base::FilePath& user_data_dir) |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 base::string16 username = base::UTF8ToUTF16(account_info.email); | 1559 base::string16 username = base::UTF8ToUTF16(account_info.email); |
1560 | 1560 |
1561 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); | 1561 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); |
1562 // |entry| and |has_entry| below are put inside a pair of brackets for | 1562 // |entry| and |has_entry| below are put inside a pair of brackets for |
1563 // scoping, to avoid potential clashes of variable names. | 1563 // scoping, to avoid potential clashes of variable names. |
1564 { | 1564 { |
1565 ProfileAttributesEntry* entry; | 1565 ProfileAttributesEntry* entry; |
1566 bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(), | 1566 bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(), |
1567 &entry); | 1567 &entry); |
1568 if (has_entry) { | 1568 if (has_entry) { |
1569 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 1569 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
1570 bool was_authenticated_status = entry->IsAuthenticated(); | 1570 bool was_authenticated_status = entry->IsAuthenticated(); |
1571 #endif | 1571 #endif |
1572 // The ProfileAttributesStorage's info must match the Signin Manager. | 1572 // The ProfileAttributesStorage's info must match the Signin Manager. |
1573 entry->SetAuthInfo(account_info.gaia, username); | 1573 entry->SetAuthInfo(account_info.gaia, username); |
1574 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 1574 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
1575 // Sign out if force-sign-in policy is enabled and profile is not signed | 1575 // Sign out if force-sign-in policy is enabled and profile is not signed |
1576 // in. | 1576 // in. |
1577 if (signin_util::IsForceSigninEnabled() && was_authenticated_status && | 1577 if (signin_util::IsForceSigninEnabled() && was_authenticated_status && |
1578 !entry->IsAuthenticated()) { | 1578 !entry->IsAuthenticated()) { |
1579 BrowserThread::PostTask( | 1579 BrowserThread::PostTask( |
1580 BrowserThread::UI, FROM_HERE, | 1580 BrowserThread::UI, FROM_HERE, |
1581 base::BindOnce(&SignOut, | 1581 base::BindOnce(&SignOut, |
1582 static_cast<SigninManager*>(signin_manager))); | 1582 static_cast<SigninManager*>(signin_manager))); |
1583 } | 1583 } |
1584 #endif | 1584 #endif |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 | 1771 |
1772 const base::FilePath new_active_profile_dir = | 1772 const base::FilePath new_active_profile_dir = |
1773 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); | 1773 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); |
1774 FinishDeletingProfile(profile_dir, new_active_profile_dir); | 1774 FinishDeletingProfile(profile_dir, new_active_profile_dir); |
1775 } | 1775 } |
1776 #endif // !defined(OS_ANDROID) | 1776 #endif // !defined(OS_ANDROID) |
1777 | 1777 |
1778 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1778 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1779 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1779 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1780 } | 1780 } |
OLD | NEW |