Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: chrome/browser/browser_main.cc

Issue 6538059: Revert 75405 - Register Application Restart with Windows Restart Manager on b... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/command_line.cc ('k') | chrome/browser/browser_main_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // BrowserMain() as a whole needs to be broken apart so that it's usable by 129 // BrowserMain() as a whole needs to be broken apart so that it's usable by
130 // other platforms. For now, it's just a stub. This is a serious work in 130 // other platforms. For now, it's just a stub. This is a serious work in
131 // progress and should not be taken as an indication of a real refactoring. 131 // progress and should not be taken as an indication of a real refactoring.
132 132
133 #if defined(OS_WIN) 133 #if defined(OS_WIN)
134 #include <commctrl.h> 134 #include <commctrl.h>
135 #include <shellapi.h> 135 #include <shellapi.h>
136 #include <windows.h> 136 #include <windows.h>
137 137
138 #include "app/win/scoped_com_initializer.h" 138 #include "app/win/scoped_com_initializer.h"
139 #include "base/win/windows_version.h"
140 #include "chrome/browser/browser_trial.h" 139 #include "chrome/browser/browser_trial.h"
141 #include "chrome/browser/metrics/user_metrics.h" 140 #include "chrome/browser/metrics/user_metrics.h"
142 #include "chrome/browser/net/url_fixer_upper.h" 141 #include "chrome/browser/net/url_fixer_upper.h"
143 #include "chrome/browser/rlz/rlz.h" 142 #include "chrome/browser/rlz/rlz.h"
144 #include "chrome/browser/ui/views/user_data_dir_dialog.h" 143 #include "chrome/browser/ui/views/user_data_dir_dialog.h"
145 #include "chrome/common/sandbox_policy.h" 144 #include "chrome/common/sandbox_policy.h"
146 #include "chrome/installer/util/helper.h" 145 #include "chrome/installer/util/helper.h"
147 #include "chrome/installer/util/install_util.h" 146 #include "chrome/installer/util/install_util.h"
148 #include "chrome/installer/util/shell_util.h" 147 #include "chrome/installer/util/shell_util.h"
149 #include "net/base/net_util.h" 148 #include "net/base/net_util.h"
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 } // if (!first_run_ui_bypass) 1576 } // if (!first_run_ui_bypass)
1578 1577
1579 Browser::SetNewHomePagePrefs(user_prefs); 1578 Browser::SetNewHomePagePrefs(user_prefs);
1580 } 1579 }
1581 1580
1582 // Sets things up so that if we crash from this point on, a dialog will 1581 // Sets things up so that if we crash from this point on, a dialog will
1583 // popup asking the user to restart chrome. It is done this late to avoid 1582 // popup asking the user to restart chrome. It is done this late to avoid
1584 // testing against a bunch of special cases that are taken care early on. 1583 // testing against a bunch of special cases that are taken care early on.
1585 PrepareRestartOnCrashEnviroment(parsed_command_line); 1584 PrepareRestartOnCrashEnviroment(parsed_command_line);
1586 1585
1587 #if defined(OS_WIN)
1588 // Registers Chrome with the Windows Restart Manager, which will restore the
1589 // Chrome session when the computer is restarted after a system update.
1590 // This could be run as late as WM_QUERYENDSESSION for system update reboots,
1591 // but should run on startup if extended to handle crashes/hangs/patches.
1592 // Also, better to run once here than once for each HWND's WM_QUERYENDSESSION.
1593 if (base::win::GetVersion() >= base::win::VERSION_VISTA)
1594 DCHECK(RegisterApplicationRestart(parsed_command_line));
1595 #endif // OS_WIN
1596
1597 // Initialize and maintain network predictor module, which handles DNS 1586 // Initialize and maintain network predictor module, which handles DNS
1598 // pre-resolution, as well as TCP/IP connection pre-warming. 1587 // pre-resolution, as well as TCP/IP connection pre-warming.
1599 // This also registers an observer to discard data when closing incognito 1588 // This also registers an observer to discard data when closing incognito
1600 // mode. 1589 // mode.
1601 bool preconnect_enabled = true; // Default status (easy to change!). 1590 bool preconnect_enabled = true; // Default status (easy to change!).
1602 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect)) 1591 if (parsed_command_line.HasSwitch(switches::kDisablePreconnect))
1603 preconnect_enabled = false; 1592 preconnect_enabled = false;
1604 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect)) 1593 else if (parsed_command_line.HasSwitch(switches::kEnablePreconnect))
1605 preconnect_enabled = true; 1594 preconnect_enabled = true;
1606 chrome_browser_net::PredictorInit dns_prefetch( 1595 chrome_browser_net::PredictorInit dns_prefetch(
1607 user_prefs, 1596 user_prefs,
1608 local_state, 1597 local_state,
1609 preconnect_enabled); 1598 preconnect_enabled);
1610 1599
1611 #if defined(OS_WIN) 1600 #if defined(OS_WIN)
1612 app::win::ScopedCOMInitializer com_initializer; 1601 app::win::ScopedCOMInitializer com_initializer;
1613 1602
1614 #if defined(GOOGLE_CHROME_BUILD) 1603 #if defined(GOOGLE_CHROME_BUILD)
1615 // Init the RLZ library. This just binds the dll and schedules a task on the 1604 // Init the RLZ library. This just binds the dll and schedules a task on the
1616 // file thread to be run sometime later. If this is the first run we record 1605 // file thread to be run sometime later. If this is the first run we record
1617 // the installation event. 1606 // the installation event.
1618 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); 1607 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay);
1619 #endif // GOOGLE_CHROME_BUILD 1608 #endif
1620 #endif // OS_WIN 1609 #endif
1621 1610
1622 // Configure modules that need access to resources. 1611 // Configure modules that need access to resources.
1623 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 1612 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
1624 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider); 1613 gfx::GfxModule::SetResourceProvider(chrome::GfxResourceProvider);
1625 1614
1626 // Register our global network handler for chrome:// and 1615 // Register our global network handler for chrome:// and
1627 // chrome-extension:// URLs. 1616 // chrome-extension:// URLs.
1628 ChromeURLDataManagerBackend::Register(); 1617 ChromeURLDataManagerBackend::Register();
1629 RegisterExtensionProtocols(); 1618 RegisterExtensionProtocols();
1630 RegisterMetadataURLRequestHandler(); 1619 RegisterMetadataURLRequestHandler();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 profile->GetCloudPrintProxyService(); 1779 profile->GetCloudPrintProxyService();
1791 1780
1792 int result_code = ResultCodes::NORMAL_EXIT; 1781 int result_code = ResultCodes::NORMAL_EXIT;
1793 if (parameters.ui_task) { 1782 if (parameters.ui_task) {
1794 // We are in test mode. Run one task and enter the main message loop. 1783 // We are in test mode. Run one task and enter the main message loop.
1795 if (pool) 1784 if (pool)
1796 pool->Recycle(); 1785 pool->Recycle();
1797 parameters.ui_task->Run(); 1786 parameters.ui_task->Run();
1798 delete parameters.ui_task; 1787 delete parameters.ui_task;
1799 } else { 1788 } else {
1800 // We are in regular browser boot sequence. Open initial tabs and enter the 1789 // We are in regular browser boot sequence. Open initial stabs and enter
1801 // main message loop. 1790 // the main message loop.
1802 if (browser_init.Start(parsed_command_line, FilePath(), profile, 1791 if (browser_init.Start(parsed_command_line, FilePath(), profile,
1803 &result_code)) { 1792 &result_code)) {
1804 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1793 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1805 // Initialize autoupdate timer. Timer callback costs basically nothing 1794 // Initialize autoupdate timer. Timer callback costs basically nothing
1806 // when browser is not in persistent mode, so it's OK to let it ride on 1795 // when browser is not in persistent mode, so it's OK to let it ride on
1807 // the main thread. This needs to be done here because we don't want 1796 // the main thread. This needs to be done here because we don't want
1808 // to start the timer when Chrome is run inside a test harness. 1797 // to start the timer when Chrome is run inside a test harness.
1809 g_browser_process->StartAutoupdateTimer(); 1798 g_browser_process->StartAutoupdateTimer();
1810 #endif 1799 #endif
1811 1800
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 #if defined(OS_CHROMEOS) 1874 #if defined(OS_CHROMEOS)
1886 // To be precise, logout (browser shutdown) is not yet done, but the 1875 // To be precise, logout (browser shutdown) is not yet done, but the
1887 // remaining work is negligible, hence we say LogoutDone here. 1876 // remaining work is negligible, hence we say LogoutDone here.
1888 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1877 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1889 false); 1878 false);
1890 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1879 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1891 #endif 1880 #endif
1892 TRACE_EVENT_END("BrowserMain", 0, 0); 1881 TRACE_EVENT_END("BrowserMain", 0, 0);
1893 return result_code; 1882 return result_code;
1894 } 1883 }
OLDNEW
« no previous file with comments | « base/command_line.cc ('k') | chrome/browser/browser_main_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698