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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 1208 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
1209 #endif // #if defined(OS_CHROMEOS) | 1209 #endif // #if defined(OS_CHROMEOS) |
1210 return breakpad_enabled; | 1210 return breakpad_enabled; |
1211 } | 1211 } |
1212 #endif // #if defined(USE_LINUX_BREAKPAD) | 1212 #endif // #if defined(USE_LINUX_BREAKPAD) |
1213 | 1213 |
1214 // Main routine for running as the Browser process. | 1214 // Main routine for running as the Browser process. |
1215 int BrowserMain(const MainFunctionParams& parameters) { | 1215 int BrowserMain(const MainFunctionParams& parameters) { |
1216 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); | 1216 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
1217 | 1217 |
| 1218 // Override the default ContentBrowserClient to let Chrome participate in |
| 1219 // content logic. |
| 1220 chrome::ChromeContentBrowserClient browser_client; |
| 1221 content::GetContentClient()->set_browser(&browser_client); |
| 1222 |
1218 // If we're running tests (ui_task is non-null). | 1223 // If we're running tests (ui_task is non-null). |
1219 if (parameters.ui_task) | 1224 if (parameters.ui_task) |
1220 browser_defaults::enable_help_app = false; | 1225 browser_defaults::enable_help_app = false; |
1221 | 1226 |
1222 scoped_ptr<BrowserMainParts> | 1227 scoped_ptr<BrowserMainParts> |
1223 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); | 1228 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); |
1224 | 1229 |
1225 parts->EarlyInitialization(); | 1230 parts->EarlyInitialization(); |
1226 | 1231 |
1227 // Must happen before we try to use a message loop or display any UI. | 1232 // Must happen before we try to use a message loop or display any UI. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 #if defined(OS_MACOSX) | 1460 #if defined(OS_MACOSX) |
1456 // Get the Keychain API to register for distributed notifications on the main | 1461 // Get the Keychain API to register for distributed notifications on the main |
1457 // thread, which has a proper CFRunloop, instead of later on the I/O thread, | 1462 // thread, which has a proper CFRunloop, instead of later on the I/O thread, |
1458 // which doesn't. This ensures those notifications will get delivered | 1463 // which doesn't. This ensures those notifications will get delivered |
1459 // properly. See issue 37766. | 1464 // properly. See issue 37766. |
1460 // (Note that the callback mask here is empty. I don't want to register for | 1465 // (Note that the callback mask here is empty. I don't want to register for |
1461 // any callbacks, I just want to initialize the mechanism.) | 1466 // any callbacks, I just want to initialize the mechanism.) |
1462 SecKeychainAddCallback(&KeychainCallback, 0, NULL); | 1467 SecKeychainAddCallback(&KeychainCallback, 0, NULL); |
1463 #endif | 1468 #endif |
1464 | 1469 |
1465 // Override the default ContentBrowserClient to let Chrome participate in | |
1466 // content logic. Must be done before any tabs or profiles are created. | |
1467 chrome::ChromeContentBrowserClient browser_client; | |
1468 content::GetContentClient()->set_browser(&browser_client); | |
1469 | |
1470 CreateChildThreads(browser_process.get()); | 1470 CreateChildThreads(browser_process.get()); |
1471 | 1471 |
1472 #if defined(OS_CHROMEOS) | 1472 #if defined(OS_CHROMEOS) |
1473 // Now that the file thread exists we can record our stats. | 1473 // Now that the file thread exists we can record our stats. |
1474 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); | 1474 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); |
1475 | 1475 |
1476 // Read locale-specific GTK resource information. | 1476 // Read locale-specific GTK resource information. |
1477 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); | 1477 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); |
1478 if (!gtkrc.empty()) | 1478 if (!gtkrc.empty()) |
1479 gtk_rc_parse_string(gtkrc.c_str()); | 1479 gtk_rc_parse_string(gtkrc.c_str()); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 #if defined(OS_CHROMEOS) | 2003 #if defined(OS_CHROMEOS) |
2004 // To be precise, logout (browser shutdown) is not yet done, but the | 2004 // To be precise, logout (browser shutdown) is not yet done, but the |
2005 // remaining work is negligible, hence we say LogoutDone here. | 2005 // remaining work is negligible, hence we say LogoutDone here. |
2006 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2006 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2007 false); | 2007 false); |
2008 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2008 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2009 #endif | 2009 #endif |
2010 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2010 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2011 return result_code; | 2011 return result_code; |
2012 } | 2012 } |
OLD | NEW |