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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 switches::kBlockReadingThirdPartyCookies); | 1358 switches::kBlockReadingThirdPartyCookies); |
1359 | 1359 |
1360 // Convert active labs into switches. Modifies the current command line. | 1360 // Convert active labs into switches. Modifies the current command line. |
1361 about_flags::ConvertFlagsToSwitches(local_state, | 1361 about_flags::ConvertFlagsToSwitches(local_state, |
1362 CommandLine::ForCurrentProcess()); | 1362 CommandLine::ForCurrentProcess()); |
1363 | 1363 |
1364 // Reset the command line in the crash report details, since we may have | 1364 // Reset the command line in the crash report details, since we may have |
1365 // just changed it to include experiments. | 1365 // just changed it to include experiments. |
1366 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 1366 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
1367 | 1367 |
| 1368 InitializeNetworkOptions(parsed_command_line()); |
| 1369 InitializeURLRequestThrottlerManager(browser_process_->net_log()); |
| 1370 |
| 1371 // Initialize histogram synchronizer system. This is a singleton and is used |
| 1372 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
| 1373 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
| 1374 // will not be deleted after the Task is executed. |
| 1375 histogram_synchronizer_ = new HistogramSynchronizer(); |
| 1376 |
| 1377 // Now the command line has been mutated based on about:flags, we can |
| 1378 // set up metrics and initialize field trials. |
| 1379 MetricsService* metrics = |
| 1380 SetupMetricsAndFieldTrials(parsed_command_line(), local_state); |
| 1381 |
| 1382 #if defined(USE_WEBKIT_COMPOSITOR) |
| 1383 // We need to ensure WebKit has been initialized before we start the WebKit |
| 1384 // compositor. This is done by the ResourceDispatcherHost on creation. |
| 1385 g_browser_process->resource_dispatcher_host(); |
| 1386 #endif |
1368 #if defined(USE_AURA) | 1387 #if defined(USE_AURA) |
1369 aura_shell::Shell::GetInstance(); | 1388 aura_shell::Shell::GetInstance(); |
1370 #elif defined(TOOLKIT_VIEWS) | 1389 #elif defined(TOOLKIT_VIEWS) |
1371 views::Widget::SetPureViews( | 1390 views::Widget::SetPureViews( |
1372 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePureViews)); | 1391 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePureViews)); |
1373 // Launch the views desktop shell window and register it as the default parent | 1392 // Launch the views desktop shell window and register it as the default parent |
1374 // for all unparented views widgets. | 1393 // for all unparented views widgets. |
1375 if (parsed_command_line().HasSwitch(switches::kViewsDesktop)) { | 1394 if (parsed_command_line().HasSwitch(switches::kViewsDesktop)) { |
1376 std::string desktop_type_cmd = | 1395 std::string desktop_type_cmd = |
1377 parsed_command_line().GetSwitchValueASCII(switches::kViewsDesktop); | 1396 parsed_command_line().GetSwitchValueASCII(switches::kViewsDesktop); |
1378 if (desktop_type_cmd != "disabled") { | 1397 if (desktop_type_cmd != "disabled") { |
1379 views::desktop::DesktopWindowView::DesktopType desktop_type; | 1398 views::desktop::DesktopWindowView::DesktopType desktop_type; |
1380 if (desktop_type_cmd == "netbook") | 1399 if (desktop_type_cmd == "netbook") |
1381 desktop_type = views::desktop::DesktopWindowView::DESKTOP_NETBOOK; | 1400 desktop_type = views::desktop::DesktopWindowView::DESKTOP_NETBOOK; |
1382 else if (desktop_type_cmd == "other") | 1401 else if (desktop_type_cmd == "other") |
1383 desktop_type = views::desktop::DesktopWindowView::DESKTOP_OTHER; | 1402 desktop_type = views::desktop::DesktopWindowView::DESKTOP_OTHER; |
1384 else | 1403 else |
1385 desktop_type = views::desktop::DesktopWindowView::DESKTOP_DEFAULT; | 1404 desktop_type = views::desktop::DesktopWindowView::DESKTOP_DEFAULT; |
1386 views::desktop::DesktopWindowView::CreateDesktopWindow(desktop_type); | 1405 views::desktop::DesktopWindowView::CreateDesktopWindow(desktop_type); |
1387 ChromeViewsDelegate* chrome_views_delegate = static_cast | 1406 ChromeViewsDelegate* chrome_views_delegate = static_cast |
1388 <ChromeViewsDelegate*>(views::ViewsDelegate::views_delegate); | 1407 <ChromeViewsDelegate*>(views::ViewsDelegate::views_delegate); |
1389 chrome_views_delegate->default_parent_view = | 1408 chrome_views_delegate->default_parent_view = |
1390 views::desktop::DesktopWindowView::desktop_window_view; | 1409 views::desktop::DesktopWindowView::desktop_window_view; |
1391 } | 1410 } |
1392 } | 1411 } |
1393 #endif | 1412 #endif |
1394 | 1413 |
1395 InitializeNetworkOptions(parsed_command_line()); | |
1396 InitializeURLRequestThrottlerManager(browser_process_->net_log()); | |
1397 | |
1398 // Initialize histogram synchronizer system. This is a singleton and is used | |
1399 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | |
1400 // scope. Even though NewRunnableMethod does AddRef and Release, the object | |
1401 // will not be deleted after the Task is executed. | |
1402 histogram_synchronizer_ = new HistogramSynchronizer(); | |
1403 | |
1404 // Now the command line has been mutated based on about:flags, we can | |
1405 // set up metrics and initialize field trials. | |
1406 MetricsService* metrics = | |
1407 SetupMetricsAndFieldTrials(parsed_command_line(), local_state); | |
1408 | |
1409 // Now that all preferences have been registered, set the install date | 1414 // Now that all preferences have been registered, set the install date |
1410 // for the uninstall metrics if this is our first run. This only actually | 1415 // for the uninstall metrics if this is our first run. This only actually |
1411 // gets used if the user has metrics reporting enabled at uninstall time. | 1416 // gets used if the user has metrics reporting enabled at uninstall time. |
1412 int64 install_date = | 1417 int64 install_date = |
1413 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); | 1418 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); |
1414 if (install_date == 0) { | 1419 if (install_date == 0) { |
1415 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, | 1420 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, |
1416 base::Time::Now().ToTimeT()); | 1421 base::Time::Now().ToTimeT()); |
1417 } | 1422 } |
1418 | 1423 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2095 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2091 (pre_read == "0" || pre_read == "1")) { | 2096 (pre_read == "0" || pre_read == "1")) { |
2092 std::string uma_name(name); | 2097 std::string uma_name(name); |
2093 uma_name += "_PreRead"; | 2098 uma_name += "_PreRead"; |
2094 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2099 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2095 AddPreReadHistogramTime(uma_name.c_str(), time); | 2100 AddPreReadHistogramTime(uma_name.c_str(), time); |
2096 } | 2101 } |
2097 #endif | 2102 #endif |
2098 #endif | 2103 #endif |
2099 } | 2104 } |
OLD | NEW |