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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreProfileInit"); | 1070 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreProfileInit"); |
1071 | 1071 |
1072 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1072 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1073 chrome_extra_parts_[i]->PreProfileInit(); | 1073 chrome_extra_parts_[i]->PreProfileInit(); |
1074 | 1074 |
1075 #if !defined(OS_ANDROID) | 1075 #if !defined(OS_ANDROID) |
1076 // Initialize the feedback uploader so it can setup notifications for profile | 1076 // Initialize the feedback uploader so it can setup notifications for profile |
1077 // creation. | 1077 // creation. |
1078 feedback::FeedbackProfileObserver::Initialize(); | 1078 feedback::FeedbackProfileObserver::Initialize(); |
1079 | 1079 |
1080 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1080 // Ephemeral profiles may have been left behind if the browser crashed. |
1081 | 1081 g_browser_process->profile_manager()->CleanUpEphemeralProfiles(); |
1082 // First check if any ephemeral profiles are left behind because of browser | |
1083 // crash and schedule them for deletion and then proceed with getting the set | |
1084 // of profiles to open. | |
1085 ProfileInfoCache& profile_cache = profile_manager->GetProfileInfoCache(); | |
1086 size_t profiles_count = profile_cache.GetNumberOfProfiles(); | |
1087 std::vector<base::FilePath> profiles_to_delete; | |
1088 for (size_t i = 0; i < profiles_count; ++i) { | |
1089 if (profile_cache.ProfileIsEphemeralAtIndex(i)) | |
1090 profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i)); | |
1091 } | |
1092 | |
1093 if (profiles_to_delete.size()) { | |
1094 for (size_t i = 0; i < profiles_to_delete.size(); ++i) { | |
1095 profile_manager->ScheduleProfileForDeletion( | |
1096 profiles_to_delete[i], ProfileManager::CreateCallback()); | |
1097 } | |
1098 // Clean up stale profiles immediately after browser start. | |
1099 BrowserThread::PostTask( | |
1100 BrowserThread::FILE, FROM_HERE, | |
1101 base::Bind(&ProfileManager::CleanUpStaleProfiles, profiles_to_delete)); | |
1102 } | |
1103 #endif // !defined(OS_ANDROID) | 1082 #endif // !defined(OS_ANDROID) |
1104 | 1083 |
1105 #if defined(ENABLE_EXTENSIONS) | 1084 #if defined(ENABLE_EXTENSIONS) |
1106 javascript_dialog_extensions_client::InstallClient(); | 1085 javascript_dialog_extensions_client::InstallClient(); |
1107 #endif // defined(ENABLE_EXTENSIONS) | 1086 #endif // defined(ENABLE_EXTENSIONS) |
1108 | 1087 |
1109 #if !defined(OS_IOS) | 1088 #if !defined(OS_IOS) |
1110 InstallChromeJavaScriptNativeDialogFactory(); | 1089 InstallChromeJavaScriptNativeDialogFactory(); |
1111 #endif // !defined(OS_IOS) | 1090 #endif // !defined(OS_IOS) |
1112 } | 1091 } |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 chromeos::CrosSettings::Shutdown(); | 1772 chromeos::CrosSettings::Shutdown(); |
1794 #endif // defined(OS_CHROMEOS) | 1773 #endif // defined(OS_CHROMEOS) |
1795 #endif // defined(OS_ANDROID) | 1774 #endif // defined(OS_ANDROID) |
1796 } | 1775 } |
1797 | 1776 |
1798 // Public members: | 1777 // Public members: |
1799 | 1778 |
1800 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1779 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1801 chrome_extra_parts_.push_back(parts); | 1780 chrome_extra_parts_.push_back(parts); |
1802 } | 1781 } |
OLD | NEW |