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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 #endif // defined(ENABLE_WEBRTC) | 227 #endif // defined(ENABLE_WEBRTC) |
228 | 228 |
229 #if defined(USE_AURA) | 229 #if defined(USE_AURA) |
230 #include "ui/aura/env.h" | 230 #include "ui/aura/env.h" |
231 #endif // defined(USE_AURA) | 231 #endif // defined(USE_AURA) |
232 | 232 |
233 using content::BrowserThread; | 233 using content::BrowserThread; |
234 | 234 |
235 namespace { | 235 namespace { |
236 | 236 |
237 #if !defined(OS_ANDROID) | |
238 // Asserts in debug builds that we don't create a new profile when cleaning up | |
239 // stale ephemeral profiles. | |
240 void DidCreateProfile(Profile* profile, Profile::CreateStatus status) { | |
241 NOTREACHED(); | |
242 } | |
243 #endif // !defined(OS_ANDROID) | |
244 | |
237 // This function provides some ways to test crash and assertion handling | 245 // This function provides some ways to test crash and assertion handling |
238 // behavior of the program. | 246 // behavior of the program. |
239 void HandleTestParameters(const base::CommandLine& command_line) { | 247 void HandleTestParameters(const base::CommandLine& command_line) { |
240 // This parameter causes a null pointer crash (crash reporter trigger). | 248 // This parameter causes a null pointer crash (crash reporter trigger). |
241 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 249 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
242 int* bad_pointer = NULL; | 250 int* bad_pointer = NULL; |
243 *bad_pointer = 0; | 251 *bad_pointer = 0; |
244 } | 252 } |
245 } | 253 } |
246 | 254 |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1085 // crash and schedule them for deletion and then proceed with getting the set | 1093 // crash and schedule them for deletion and then proceed with getting the set |
1086 // of profiles to open. | 1094 // of profiles to open. |
1087 ProfileInfoCache& profile_cache = profile_manager->GetProfileInfoCache(); | 1095 ProfileInfoCache& profile_cache = profile_manager->GetProfileInfoCache(); |
1088 size_t profiles_count = profile_cache.GetNumberOfProfiles(); | 1096 size_t profiles_count = profile_cache.GetNumberOfProfiles(); |
1089 std::vector<base::FilePath> profiles_to_delete; | 1097 std::vector<base::FilePath> profiles_to_delete; |
1090 for (size_t i = 0; i < profiles_count; ++i) { | 1098 for (size_t i = 0; i < profiles_count; ++i) { |
1091 if (profile_cache.ProfileIsEphemeralAtIndex(i)) | 1099 if (profile_cache.ProfileIsEphemeralAtIndex(i)) |
1092 profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i)); | 1100 profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i)); |
1093 } | 1101 } |
1094 | 1102 |
1095 if (profiles_to_delete.size()) { | 1103 for (size_t i = 0; i < profiles_to_delete.size(); ++i) { |
Mike Lerman
2015/05/05 13:44:45
Can you put a comment above profiles_to_delete tha
Bernhard Bauer
2015/05/05 14:33:21
Done.
| |
1096 for (size_t i = 0; i < profiles_to_delete.size(); ++i) { | 1104 profile_manager->ScheduleProfileForDeletion( |
1097 profile_manager->ScheduleProfileForDeletion( | 1105 profiles_to_delete[i], true /* suppress_profile_creation */, |
1098 profiles_to_delete[i], ProfileManager::CreateCallback()); | 1106 base::Bind(&DidCreateProfile)); |
Mike Lerman
2015/05/05 13:44:45
I think you can just put a ProfileManager::CreateC
Bernhard Bauer
2015/05/05 14:33:21
Done.
| |
1099 } | |
1100 // Clean up stale profiles immediately after browser start. | |
1101 BrowserThread::PostTask( | |
Mike Lerman
2015/05/05 13:44:45
Why is CleanUpStaleProfiles no longer necessary? I
Bernhard Bauer
2015/05/05 14:33:21
It already did that before (in FinishDeletingProfi
| |
1102 BrowserThread::FILE, FROM_HERE, | |
1103 base::Bind(&ProfileManager::CleanUpStaleProfiles, profiles_to_delete)); | |
1104 } | 1107 } |
1105 #endif // !defined(OS_ANDROID) | 1108 #endif // !defined(OS_ANDROID) |
1106 | 1109 |
1107 #if defined(ENABLE_EXTENSIONS) | 1110 #if defined(ENABLE_EXTENSIONS) |
1108 javascript_dialog_extensions_client::InstallClient(); | 1111 javascript_dialog_extensions_client::InstallClient(); |
1109 #endif // defined(ENABLE_EXTENSIONS) | 1112 #endif // defined(ENABLE_EXTENSIONS) |
1110 | 1113 |
1111 #if !defined(OS_IOS) | 1114 #if !defined(OS_IOS) |
1112 InstallChromeJavaScriptNativeDialogFactory(); | 1115 InstallChromeJavaScriptNativeDialogFactory(); |
1113 #endif // !defined(OS_IOS) | 1116 #endif // !defined(OS_IOS) |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1795 chromeos::CrosSettings::Shutdown(); | 1798 chromeos::CrosSettings::Shutdown(); |
1796 #endif // defined(OS_CHROMEOS) | 1799 #endif // defined(OS_CHROMEOS) |
1797 #endif // defined(OS_ANDROID) | 1800 #endif // defined(OS_ANDROID) |
1798 } | 1801 } |
1799 | 1802 |
1800 // Public members: | 1803 // Public members: |
1801 | 1804 |
1802 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1805 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1803 chrome_extra_parts_.push_back(parts); | 1806 chrome_extra_parts_.push_back(parts); |
1804 } | 1807 } |
OLD | NEW |