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