| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 #if defined(OS_MACOSX) | 612 #if defined(OS_MACOSX) |
| 613 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 613 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 614 SecKeychainCallbackInfo *info, void *context) { | 614 SecKeychainCallbackInfo *info, void *context) { |
| 615 return noErr; | 615 return noErr; |
| 616 } | 616 } |
| 617 #endif | 617 #endif |
| 618 | 618 |
| 619 } // namespace | 619 } // namespace |
| 620 | 620 |
| 621 #if defined(OS_WIN) |
| 622 #define DLLEXPORT __declspec(dllexport) |
| 623 |
| 624 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| 625 extern "C" { |
| 626 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 627 } |
| 628 |
| 629 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { |
| 630 Upgrade::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 631 } |
| 632 #endif |
| 633 |
| 621 // Main routine for running as the Browser process. | 634 // Main routine for running as the Browser process. |
| 622 int BrowserMain(const MainFunctionParams& parameters) { | 635 int BrowserMain(const MainFunctionParams& parameters) { |
| 623 const CommandLine& parsed_command_line = parameters.command_line_; | 636 const CommandLine& parsed_command_line = parameters.command_line_; |
| 624 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 637 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
| 625 | 638 |
| 626 // WARNING: If we get a WM_ENDSESSION objects created on the stack here | 639 // WARNING: If we get a WM_ENDSESSION objects created on the stack here |
| 627 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 640 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
| 628 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 641 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
| 629 | 642 |
| 630 // TODO(beng, brettw): someday, break this out into sub functions with well | 643 // TODO(beng, brettw): someday, break this out into sub functions with well |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 RunUIMessageLoop(browser_process.get()); | 1183 RunUIMessageLoop(browser_process.get()); |
| 1171 #else | 1184 #else |
| 1172 parameters.ui_task->Run(); | 1185 parameters.ui_task->Run(); |
| 1173 delete parameters.ui_task; | 1186 delete parameters.ui_task; |
| 1174 #endif | 1187 #endif |
| 1175 } else { | 1188 } else { |
| 1176 // We are in regular browser boot sequence. Open initial stabs and enter | 1189 // We are in regular browser boot sequence. Open initial stabs and enter |
| 1177 // the main message loop. | 1190 // the main message loop. |
| 1178 if (browser_init.Start(parsed_command_line, std::wstring(), profile, | 1191 if (browser_init.Start(parsed_command_line, std::wstring(), profile, |
| 1179 &result_code)) { | 1192 &result_code)) { |
| 1180 #if defined(OS_WIN) | 1193 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 1181 // Initialize autoupdate timer. Timer callback costs basically nothing | 1194 // Initialize autoupdate timer. Timer callback costs basically nothing |
| 1182 // when browser is not in persistent mode, so it's OK to let it ride on | 1195 // when browser is not in persistent mode, so it's OK to let it ride on |
| 1183 // the main thread. This needs to be done here because we don't want | 1196 // the main thread. This needs to be done here because we don't want |
| 1184 // to start the timer when Chrome is run inside a test harness. | 1197 // to start the timer when Chrome is run inside a test harness. |
| 1185 g_browser_process->StartAutoupdateTimer(); | 1198 g_browser_process->StartAutoupdateTimer(); |
| 1186 #endif | 1199 #endif |
| 1187 | 1200 |
| 1201 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1202 // On Linux, the running exe will be updated if an upgrade becomes |
| 1203 // available while the browser is running. We need to save the last |
| 1204 // modified time of the exe, so we can compare to determine if there is |
| 1205 // an upgrade while the browser is kept alive by a persistent extension. |
| 1206 Upgrade::SaveLastModifiedTimeOfExe(); |
| 1207 #endif |
| 1208 |
| 1188 // Record now as the last succesful chrome start. | 1209 // Record now as the last succesful chrome start. |
| 1189 GoogleUpdateSettings::SetLastRunTime(); | 1210 GoogleUpdateSettings::SetLastRunTime(); |
| 1190 // Call Recycle() here as late as possible, before going into the loop | 1211 // Call Recycle() here as late as possible, before going into the loop |
| 1191 // because Start() will add things to it while creating the main window. | 1212 // because Start() will add things to it while creating the main window. |
| 1192 if (pool) | 1213 if (pool) |
| 1193 pool->Recycle(); | 1214 pool->Recycle(); |
| 1194 RunUIMessageLoop(browser_process.get()); | 1215 RunUIMessageLoop(browser_process.get()); |
| 1195 } | 1216 } |
| 1196 } | 1217 } |
| 1197 | 1218 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1225 | 1246 |
| 1226 metrics->Stop(); | 1247 metrics->Stop(); |
| 1227 | 1248 |
| 1228 // browser_shutdown takes care of deleting browser_process, so we need to | 1249 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1229 // release it. | 1250 // release it. |
| 1230 browser_process.release(); | 1251 browser_process.release(); |
| 1231 browser_shutdown::Shutdown(); | 1252 browser_shutdown::Shutdown(); |
| 1232 | 1253 |
| 1233 return result_code; | 1254 return result_code; |
| 1234 } | 1255 } |
| OLD | NEW |