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