OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1512 } // if (!first_run_ui_bypass) | 1512 } // if (!first_run_ui_bypass) |
1513 | 1513 |
1514 Browser::SetNewHomePagePrefs(user_prefs); | 1514 Browser::SetNewHomePagePrefs(user_prefs); |
1515 } | 1515 } |
1516 | 1516 |
1517 // Sets things up so that if we crash from this point on, a dialog will | 1517 // Sets things up so that if we crash from this point on, a dialog will |
1518 // popup asking the user to restart chrome. It is done this late to avoid | 1518 // popup asking the user to restart chrome. It is done this late to avoid |
1519 // testing against a bunch of special cases that are taken care early on. | 1519 // testing against a bunch of special cases that are taken care early on. |
1520 PrepareRestartOnCrashEnviroment(parsed_command_line); | 1520 PrepareRestartOnCrashEnviroment(parsed_command_line); |
1521 | 1521 |
1522 #if defined(OS_WIN) | |
1523 // Registers Chrome with the Windows Restart Manager, which will restore the | |
1524 // Chrome session when the computer is restarted after a system update. | |
1525 // This could be run as late as WM_QUERYENDSESSION for system update reboots, | |
1526 // but should run on startup if extended to handle crashes/hangs/patches. | |
cpu_(ooo_6.6-7.5)
2011/02/10 18:59:24
we already handle this restart on crashes see Dump
msw
2011/02/10 19:54:54
Yup, I'm aware but thought it's worth considering
| |
1527 // Also, better to run once here than once for each HWND's WM_QUERYENDSESSION. | |
1528 RegisterApplicationRestart(parsed_command_line); | |
1529 #endif // OS_WIN | |
1530 | |
1522 // Initialize and maintain network predictor module, which handles DNS | 1531 // Initialize and maintain network predictor module, which handles DNS |
1523 // pre-resolution, as well as TCP/IP connection pre-warming. | 1532 // pre-resolution, as well as TCP/IP connection pre-warming. |
1524 // This also registers an observer to discard data when closing incognito | 1533 // This also registers an observer to discard data when closing incognito |
1525 // mode. | 1534 // mode. |
1526 bool preconnect_enabled = true; // Default status (easy to change!). | 1535 bool preconnect_enabled = true; // Default status (easy to change!). |
1527 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect)) | 1536 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect)) |
1528 preconnect_enabled = false; | 1537 preconnect_enabled = false; |
1529 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect)) | 1538 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect)) |
1530 preconnect_enabled = true; | 1539 preconnect_enabled = true; |
1531 chrome_browser_net::PredictorInit dns_prefetch( | 1540 chrome_browser_net::PredictorInit dns_prefetch( |
1532 user_prefs, | 1541 user_prefs, |
1533 local_state, | 1542 local_state, |
1534 preconnect_enabled); | 1543 preconnect_enabled); |
1535 | 1544 |
1536 #if defined(OS_WIN) | 1545 #if defined(OS_WIN) |
1537 app::win::ScopedCOMInitializer com_initializer; | 1546 app::win::ScopedCOMInitializer com_initializer; |
1538 | 1547 |
1539 #if defined(GOOGLE_CHROME_BUILD) | 1548 #if defined(GOOGLE_CHROME_BUILD) |
1540 // Init the RLZ library. This just binds the dll and schedules a task on the | 1549 // Init the RLZ library. This just binds the dll and schedules a task on the |
1541 // file thread to be run sometime later. If this is the first run we record | 1550 // file thread to be run sometime later. If this is the first run we record |
1542 // the installation event. | 1551 // the installation event. |
1543 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); | 1552 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); |
1544 #endif | 1553 #endif // GOOGLE_CHROME_BUILD |
1545 #endif | 1554 #endif // OS_WIN |
1546 | 1555 |
1547 // Configure modules that need access to resources. | 1556 // Configure modules that need access to resources. |
1548 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1557 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
1549 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider); | 1558 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider); |
1550 | 1559 |
1551 // Register our global network handler for chrome:// and | 1560 // Register our global network handler for chrome:// and |
1552 // chrome-extension:// URLs. | 1561 // chrome-extension:// URLs. |
1553 ChromeURLDataManagerBackend::Register(); | 1562 ChromeURLDataManagerBackend::Register(); |
1554 RegisterExtensionProtocols(); | 1563 RegisterExtensionProtocols(); |
1555 RegisterMetadataURLRequestHandler(); | 1564 RegisterMetadataURLRequestHandler(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1715 profile->GetCloudPrintProxyService(); | 1724 profile->GetCloudPrintProxyService(); |
1716 | 1725 |
1717 int result_code = ResultCodes::NORMAL_EXIT; | 1726 int result_code = ResultCodes::NORMAL_EXIT; |
1718 if (parameters.ui_task) { | 1727 if (parameters.ui_task) { |
1719 // We are in test mode. Run one task and enter the main message loop. | 1728 // We are in test mode. Run one task and enter the main message loop. |
1720 if (pool) | 1729 if (pool) |
1721 pool->Recycle(); | 1730 pool->Recycle(); |
1722 parameters.ui_task->Run(); | 1731 parameters.ui_task->Run(); |
1723 delete parameters.ui_task; | 1732 delete parameters.ui_task; |
1724 } else { | 1733 } else { |
1725 // We are in regular browser boot sequence. Open initial stabs and enter | 1734 // We are in regular browser boot sequence. Open initial tabs and enter |
1726 // the main message loop. | 1735 // the main message loop. |
1727 if (browser_init.Start(parsed_command_line, FilePath(), profile, | 1736 if (browser_init.Start(parsed_command_line, FilePath(), profile, |
1728 &result_code)) { | 1737 &result_code)) { |
1729 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1738 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
1730 // Initialize autoupdate timer. Timer callback costs basically nothing | 1739 // Initialize autoupdate timer. Timer callback costs basically nothing |
1731 // when browser is not in persistent mode, so it's OK to let it ride on | 1740 // when browser is not in persistent mode, so it's OK to let it ride on |
1732 // the main thread. This needs to be done here because we don't want | 1741 // the main thread. This needs to be done here because we don't want |
1733 // to start the timer when Chrome is run inside a test harness. | 1742 // to start the timer when Chrome is run inside a test harness. |
1734 g_browser_process->StartAutoupdateTimer(); | 1743 g_browser_process->StartAutoupdateTimer(); |
1735 #endif | 1744 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1810 #if defined(OS_CHROMEOS) | 1819 #if defined(OS_CHROMEOS) |
1811 // To be precise, logout (browser shutdown) is not yet done, but the | 1820 // To be precise, logout (browser shutdown) is not yet done, but the |
1812 // remaining work is negligible, hence we say LogoutDone here. | 1821 // remaining work is negligible, hence we say LogoutDone here. |
1813 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1822 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1814 false); | 1823 false); |
1815 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1824 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1816 #endif | 1825 #endif |
1817 TRACE_EVENT_END("BrowserMain", 0, 0); | 1826 TRACE_EVENT_END("BrowserMain", 0, 0); |
1818 return result_code; | 1827 return result_code; |
1819 } | 1828 } |
OLD | NEW |