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