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 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1510 } // if (!first_run_ui_bypass) | 1510 } // if (!first_run_ui_bypass) |
1511 | 1511 |
1512 Browser::SetNewHomePagePrefs(user_prefs); | 1512 Browser::SetNewHomePagePrefs(user_prefs); |
1513 } | 1513 } |
1514 | 1514 |
1515 // Sets things up so that if we crash from this point on, a dialog will | 1515 // Sets things up so that if we crash from this point on, a dialog will |
1516 // popup asking the user to restart chrome. It is done this late to avoid | 1516 // popup asking the user to restart chrome. It is done this late to avoid |
1517 // testing against a bunch of special cases that are taken care early on. | 1517 // testing against a bunch of special cases that are taken care early on. |
1518 PrepareRestartOnCrashEnviroment(parsed_command_line); | 1518 PrepareRestartOnCrashEnviroment(parsed_command_line); |
1519 | 1519 |
1520 #if defined(OS_WIN) | |
1521 RegisterApplicationRestart(parsed_command_line); | |
Ben Goodger (Google)
2011/02/10 16:56:49
You might add a quick note here saying what this d
msw
2011/02/10 18:35:06
Done. Added your same comment from the function de
| |
1522 #endif // OS_WIN | |
1523 | |
1520 // Initialize and maintain network predictor module, which handles DNS | 1524 // Initialize and maintain network predictor module, which handles DNS |
1521 // pre-resolution, as well as TCP/IP connection pre-warming. | 1525 // pre-resolution, as well as TCP/IP connection pre-warming. |
1522 // This also registers an observer to discard data when closing incognito | 1526 // This also registers an observer to discard data when closing incognito |
1523 // mode. | 1527 // mode. |
1524 bool preconnect_enabled = true; // Default status (easy to change!). | 1528 bool preconnect_enabled = true; // Default status (easy to change!). |
1525 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect)) | 1529 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect)) |
1526 preconnect_enabled = false; | 1530 preconnect_enabled = false; |
1527 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect)) | 1531 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect)) |
1528 preconnect_enabled = true; | 1532 preconnect_enabled = true; |
1529 chrome_browser_net::PredictorInit dns_prefetch( | 1533 chrome_browser_net::PredictorInit dns_prefetch( |
1530 user_prefs, | 1534 user_prefs, |
1531 local_state, | 1535 local_state, |
1532 preconnect_enabled); | 1536 preconnect_enabled); |
1533 | 1537 |
1534 #if defined(OS_WIN) | 1538 #if defined(OS_WIN) |
1535 app::win::ScopedCOMInitializer com_initializer; | 1539 app::win::ScopedCOMInitializer com_initializer; |
1536 | 1540 |
1537 #if defined(GOOGLE_CHROME_BUILD) | 1541 #if defined(GOOGLE_CHROME_BUILD) |
1538 // Init the RLZ library. This just binds the dll and schedules a task on the | 1542 // Init the RLZ library. This just binds the dll and schedules a task on the |
1539 // file thread to be run sometime later. If this is the first run we record | 1543 // file thread to be run sometime later. If this is the first run we record |
1540 // the installation event. | 1544 // the installation event. |
1541 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); | 1545 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); |
1542 #endif | 1546 #endif // GOOGLE_CHROME_BUILD |
1543 #endif | 1547 #endif // OS_WIN |
1544 | 1548 |
1545 // Configure modules that need access to resources. | 1549 // Configure modules that need access to resources. |
1546 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1550 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
1547 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider); | 1551 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider); |
1548 | 1552 |
1549 // Register our global network handler for chrome:// and | 1553 // Register our global network handler for chrome:// and |
1550 // chrome-extension:// URLs. | 1554 // chrome-extension:// URLs. |
1551 RegisterURLRequestChromeJob(); | 1555 RegisterURLRequestChromeJob(); |
1552 RegisterExtensionProtocols(); | 1556 RegisterExtensionProtocols(); |
1553 RegisterMetadataURLRequestHandler(); | 1557 RegisterMetadataURLRequestHandler(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1713 profile->GetCloudPrintProxyService(); | 1717 profile->GetCloudPrintProxyService(); |
1714 | 1718 |
1715 int result_code = ResultCodes::NORMAL_EXIT; | 1719 int result_code = ResultCodes::NORMAL_EXIT; |
1716 if (parameters.ui_task) { | 1720 if (parameters.ui_task) { |
1717 // We are in test mode. Run one task and enter the main message loop. | 1721 // We are in test mode. Run one task and enter the main message loop. |
1718 if (pool) | 1722 if (pool) |
1719 pool->Recycle(); | 1723 pool->Recycle(); |
1720 parameters.ui_task->Run(); | 1724 parameters.ui_task->Run(); |
1721 delete parameters.ui_task; | 1725 delete parameters.ui_task; |
1722 } else { | 1726 } else { |
1723 // We are in regular browser boot sequence. Open initial stabs and enter | 1727 // We are in regular browser boot sequence. Open initial tabs and enter |
1724 // the main message loop. | 1728 // the main message loop. |
1725 if (browser_init.Start(parsed_command_line, FilePath(), profile, | 1729 if (browser_init.Start(parsed_command_line, FilePath(), profile, |
1726 &result_code)) { | 1730 &result_code)) { |
1727 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1731 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
1728 // Initialize autoupdate timer. Timer callback costs basically nothing | 1732 // Initialize autoupdate timer. Timer callback costs basically nothing |
1729 // when browser is not in persistent mode, so it's OK to let it ride on | 1733 // when browser is not in persistent mode, so it's OK to let it ride on |
1730 // the main thread. This needs to be done here because we don't want | 1734 // the main thread. This needs to be done here because we don't want |
1731 // to start the timer when Chrome is run inside a test harness. | 1735 // to start the timer when Chrome is run inside a test harness. |
1732 g_browser_process->StartAutoupdateTimer(); | 1736 g_browser_process->StartAutoupdateTimer(); |
1733 #endif | 1737 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1808 #if defined(OS_CHROMEOS) | 1812 #if defined(OS_CHROMEOS) |
1809 // To be precise, logout (browser shutdown) is not yet done, but the | 1813 // To be precise, logout (browser shutdown) is not yet done, but the |
1810 // remaining work is negligible, hence we say LogoutDone here. | 1814 // remaining work is negligible, hence we say LogoutDone here. |
1811 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1815 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1812 false); | 1816 false); |
1813 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1817 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1814 #endif | 1818 #endif |
1815 TRACE_EVENT_END("BrowserMain", 0, 0); | 1819 TRACE_EVENT_END("BrowserMain", 0, 0); |
1816 return result_code; | 1820 return result_code; |
1817 } | 1821 } |
OLD | NEW |