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

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

Issue 307673002: Remove passwords from the keychain if profile is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add RunAllPendingInMessageLoop Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/deferred_sequenced_task_runner.h" 12 #include "base/deferred_sequenced_task_runner.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_enumerator.h" 14 #include "base/files/file_enumerator.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
18 #include "base/prefs/scoped_user_pref_update.h" 18 #include "base/prefs/scoped_user_pref_update.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/content_settings/host_content_settings_map.h" 25 #include "chrome/browser/content_settings/host_content_settings_map.h"
26 #include "chrome/browser/download/download_service.h" 26 #include "chrome/browser/download/download_service.h"
27 #include "chrome/browser/download/download_service_factory.h" 27 #include "chrome/browser/download/download_service_factory.h"
28 #include "chrome/browser/password_manager/password_store_factory.h"
28 #include "chrome/browser/prefs/incognito_mode_prefs.h" 29 #include "chrome/browser/prefs/incognito_mode_prefs.h"
29 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" 30 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
30 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 31 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
31 #include "chrome/browser/profiles/profile_destroyer.h" 32 #include "chrome/browser/profiles/profile_destroyer.h"
32 #include "chrome/browser/profiles/profile_info_cache.h" 33 #include "chrome/browser/profiles/profile_info_cache.h"
33 #include "chrome/browser/profiles/profile_metrics.h" 34 #include "chrome/browser/profiles/profile_metrics.h"
34 #include "chrome/browser/profiles/profiles_state.h" 35 #include "chrome/browser/profiles/profiles_state.h"
35 #include "chrome/browser/profiles/startup_task_runner_service.h" 36 #include "chrome/browser/profiles/startup_task_runner_service.h"
36 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" 37 #include "chrome/browser/profiles/startup_task_runner_service_factory.h"
37 #include "chrome/browser/signin/account_reconcilor_factory.h" 38 #include "chrome/browser/signin/account_reconcilor_factory.h"
38 #include "chrome/browser/sync/profile_sync_service.h" 39 #include "chrome/browser/sync/profile_sync_service.h"
39 #include "chrome/browser/sync/profile_sync_service_factory.h" 40 #include "chrome/browser/sync/profile_sync_service_factory.h"
40 #include "chrome/browser/ui/browser.h" 41 #include "chrome/browser/ui/browser.h"
41 #include "chrome/browser/ui/browser_iterator.h" 42 #include "chrome/browser/ui/browser_iterator.h"
42 #include "chrome/browser/ui/sync/sync_promo_ui.h" 43 #include "chrome/browser/ui/sync/sync_promo_ui.h"
43 #include "chrome/common/chrome_constants.h" 44 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/chrome_paths_internal.h" 45 #include "chrome/common/chrome_paths_internal.h"
45 #include "chrome/common/chrome_switches.h" 46 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/logging_chrome.h" 47 #include "chrome/common/logging_chrome.h"
47 #include "chrome/common/pref_names.h" 48 #include "chrome/common/pref_names.h"
48 #include "chrome/common/url_constants.h" 49 #include "chrome/common/url_constants.h"
49 #include "components/bookmarks/browser/bookmark_model.h" 50 #include "components/bookmarks/browser/bookmark_model.h"
51 #include "components/password_manager/core/browser/password_store.h"
50 #include "components/signin/core/common/profile_management_switches.h" 52 #include "components/signin/core/common/profile_management_switches.h"
51 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
52 #include "content/public/browser/notification_service.h" 54 #include "content/public/browser/notification_service.h"
53 #include "content/public/browser/user_metrics.h" 55 #include "content/public/browser/user_metrics.h"
54 #include "extensions/browser/extension_registry.h" 56 #include "extensions/browser/extension_registry.h"
55 #include "extensions/common/extension_set.h" 57 #include "extensions/common/extension_set.h"
56 #include "extensions/common/manifest.h" 58 #include "extensions/common/manifest.h"
57 #include "grit/generated_resources.h" 59 #include "grit/generated_resources.h"
58 #include "net/http/http_transaction_factory.h" 60 #include "net/http/http_transaction_factory.h"
59 #include "net/url_request/url_request_context.h" 61 #include "net/url_request/url_request_context.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)-> 1085 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)->
1084 NonMaliciousDownloadCount() == 0); 1086 NonMaliciousDownloadCount() == 0);
1085 BrowserList::CloseAllBrowsersWithProfile(profile); 1087 BrowserList::CloseAllBrowsersWithProfile(profile);
1086 1088
1087 // Disable sync for doomed profile. 1089 // Disable sync for doomed profile.
1088 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( 1090 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
1089 profile)) { 1091 profile)) {
1090 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 1092 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
1091 profile)->DisableForUser(); 1093 profile)->DisableForUser();
1092 } 1094 }
1095
1096 // Some platforms store passwords in keychains. They should be removed.
1097 scoped_refptr<password_manager::PasswordStore> password_store =
1098 PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS)
1099 .get();
1100 if (password_store) {
1101 password_store->RemoveLoginsCreatedBetween(base::Time(),
1102 base::Time::Max());
1103 }
1093 } 1104 }
1094 1105
1095 QueueProfileDirectoryForDeletion(profile_dir); 1106 QueueProfileDirectoryForDeletion(profile_dir);
1096 cache.DeleteProfileFromCache(profile_dir); 1107 cache.DeleteProfileFromCache(profile_dir);
1097 ProfileMetrics::UpdateReportedProfilesStatistics(this); 1108 ProfileMetrics::UpdateReportedProfilesStatistics(this);
1098 } 1109 }
1099 1110
1100 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( 1111 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
1101 Profile* profile, 1112 Profile* profile,
1102 bool created) { 1113 bool created) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 last_non_managed_profile_path.BaseName().MaybeAsASCII()); 1290 last_non_managed_profile_path.BaseName().MaybeAsASCII());
1280 FinishDeletingProfile(profile_to_delete_path); 1291 FinishDeletingProfile(profile_to_delete_path);
1281 } 1292 }
1282 } 1293 }
1283 } 1294 }
1284 #endif 1295 #endif
1285 1296
1286 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1297 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1287 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1298 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1288 } 1299 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698