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 <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" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
32 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 32 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
33 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h" | 33 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h" |
34 #include "chrome/browser/password_manager/password_store_factory.h" | 34 #include "chrome/browser/password_manager/password_store_factory.h" |
35 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 35 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
36 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 36 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
37 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 37 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
38 #include "chrome/browser/profiles/profile_destroyer.h" | 38 #include "chrome/browser/profiles/profile_destroyer.h" |
39 #include "chrome/browser/profiles/profile_info_cache.h" | 39 #include "chrome/browser/profiles/profile_info_cache.h" |
40 #include "chrome/browser/profiles/profile_metrics.h" | 40 #include "chrome/browser/profiles/profile_metrics.h" |
41 #include "chrome/browser/profiles/profile_statistics.h" | |
41 #include "chrome/browser/profiles/profiles_state.h" | 42 #include "chrome/browser/profiles/profiles_state.h" |
42 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 43 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
43 #include "chrome/browser/signin/account_reconcilor_factory.h" | 44 #include "chrome/browser/signin/account_reconcilor_factory.h" |
44 #include "chrome/browser/signin/account_tracker_service_factory.h" | 45 #include "chrome/browser/signin/account_tracker_service_factory.h" |
45 #include "chrome/browser/signin/cross_device_promo.h" | 46 #include "chrome/browser/signin/cross_device_promo.h" |
46 #include "chrome/browser/signin/cross_device_promo_factory.h" | 47 #include "chrome/browser/signin/cross_device_promo_factory.h" |
47 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 48 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
48 #include "chrome/browser/signin/signin_manager_factory.h" | 49 #include "chrome/browser/signin/signin_manager_factory.h" |
49 #include "chrome/browser/sync/profile_sync_service_factory.h" | 50 #include "chrome/browser/sync/profile_sync_service_factory.h" |
50 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 | 1049 |
1049 DoFinalInitForServices(profile, go_off_the_record); | 1050 DoFinalInitForServices(profile, go_off_the_record); |
1050 AddProfileToCache(profile); | 1051 AddProfileToCache(profile); |
1051 DoFinalInitLogging(profile); | 1052 DoFinalInitLogging(profile); |
1052 | 1053 |
1053 ProfileMetrics::LogNumberOfProfiles(this); | 1054 ProfileMetrics::LogNumberOfProfiles(this); |
1054 content::NotificationService::current()->Notify( | 1055 content::NotificationService::current()->Notify( |
1055 chrome::NOTIFICATION_PROFILE_ADDED, | 1056 chrome::NOTIFICATION_PROFILE_ADDED, |
1056 content::Source<Profile>(profile), | 1057 content::Source<Profile>(profile), |
1057 content::NotificationService::NoDetails()); | 1058 content::NotificationService::NoDetails()); |
1059 | |
1060 // Record statistics to ProfileInfoCache if not a normal shutdown. | |
Mike Lerman
2015/11/26 15:06:25
rephrase to
Record statistics to ProfileInfoCache
lwchkg
2015/12/02 15:33:34
Yeah we need to make this comment clearer.
I've r
| |
1061 if (!profile->IsGuestSession() && !profile->IsSystemProfile() && | |
1062 !profile->IsNewProfile() && !go_off_the_record && | |
1063 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) | |
Mike Lerman
2015/11/26 15:06:25
nit: use braces around the statement
lwchkg
2015/12/02 15:33:34
Yeah it looks better with the braces.
Just someth
Mike Lerman
2015/12/07 16:21:20
I'm not aware of a change, but that doesn't mean o
lwchkg
2015/12/09 03:39:41
I see. I can't read this message clearly with the
| |
1064 profiles::StoreProfileStatisticsToCache(profile); | |
1058 } | 1065 } |
1059 | 1066 |
1060 void ProfileManager::DoFinalInitForServices(Profile* profile, | 1067 void ProfileManager::DoFinalInitForServices(Profile* profile, |
1061 bool go_off_the_record) { | 1068 bool go_off_the_record) { |
1062 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); | 1069 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); |
1063 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices"); | 1070 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices"); |
1064 | 1071 |
1065 #if defined(ENABLE_EXTENSIONS) | 1072 #if defined(ENABLE_EXTENSIONS) |
1066 ProfileInfoCache& cache = GetProfileInfoCache(); | 1073 ProfileInfoCache& cache = GetProfileInfoCache(); |
1067 | 1074 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1454 | 1461 |
1455 void ProfileManager::BrowserListObserver::OnBrowserRemoved( | 1462 void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
1456 Browser* browser) { | 1463 Browser* browser) { |
1457 Profile* profile = browser->profile(); | 1464 Profile* profile = browser->profile(); |
1458 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 1465 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
1459 if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile()) | 1466 if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile()) |
1460 // Not the last window for this profile. | 1467 // Not the last window for this profile. |
1461 return; | 1468 return; |
1462 } | 1469 } |
1463 | 1470 |
1471 // Store statistics into ProfileInfoCache. | |
1472 profiles::StoreProfileStatisticsToCache(profile); | |
1473 | |
1464 // If the last browser of a profile that is scheduled for deletion is closed | 1474 // If the last browser of a profile that is scheduled for deletion is closed |
1465 // do that now. | 1475 // do that now. |
1466 base::FilePath path = profile->GetPath(); | 1476 base::FilePath path = profile->GetPath(); |
1467 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) && | 1477 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) && |
1468 !IsProfileMarkedForDeletion(path)) { | 1478 !IsProfileMarkedForDeletion(path)) { |
1469 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 1479 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
1470 path, ProfileManager::CreateCallback()); | 1480 path, ProfileManager::CreateCallback()); |
1471 } | 1481 } |
1472 } | 1482 } |
1473 | 1483 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1513 | 1523 |
1514 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1524 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
1515 if (!original_callback.is_null()) | 1525 if (!original_callback.is_null()) |
1516 original_callback.Run(loaded_profile, status); | 1526 original_callback.Run(loaded_profile, status); |
1517 } | 1527 } |
1518 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 1528 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
1519 | 1529 |
1520 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1530 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1521 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1531 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1522 } | 1532 } |
OLD | NEW |