| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 #include "net/base/ssl_config_service.h" | 112 #include "net/base/ssl_config_service.h" |
| 113 #include "net/cookies/cookie_monster.h" | 113 #include "net/cookies/cookie_monster.h" |
| 114 #include "net/http/http_basic_stream.h" | 114 #include "net/http/http_basic_stream.h" |
| 115 #include "net/http/http_network_layer.h" | 115 #include "net/http/http_network_layer.h" |
| 116 #include "net/http/http_stream_factory.h" | 116 #include "net/http/http_stream_factory.h" |
| 117 #include "net/socket/client_socket_pool_base.h" | 117 #include "net/socket/client_socket_pool_base.h" |
| 118 #include "net/socket/client_socket_pool_manager.h" | 118 #include "net/socket/client_socket_pool_manager.h" |
| 119 #include "net/spdy/spdy_session.h" | 119 #include "net/spdy/spdy_session.h" |
| 120 #include "net/spdy/spdy_session_pool.h" | 120 #include "net/spdy/spdy_session_pool.h" |
| 121 #include "net/url_request/url_request.h" | 121 #include "net/url_request/url_request.h" |
| 122 #include "net/url_request/url_request_throttler_manager.h" | |
| 123 #include "net/websockets/websocket_job.h" | 122 #include "net/websockets/websocket_job.h" |
| 124 #include "ui/base/l10n/l10n_util.h" | 123 #include "ui/base/l10n/l10n_util.h" |
| 125 #include "ui/base/resource/resource_bundle.h" | 124 #include "ui/base/resource/resource_bundle.h" |
| 126 #include "ui/base/resource/resource_handle.h" | 125 #include "ui/base/resource/resource_handle.h" |
| 127 | 126 |
| 128 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 127 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 129 #include "chrome/browser/first_run/upgrade_util_linux.h" | 128 #include "chrome/browser/first_run/upgrade_util_linux.h" |
| 130 #endif | 129 #endif |
| 131 | 130 |
| 132 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | 266 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
| 268 int value; | 267 int value; |
| 269 base::StringToInt( | 268 base::StringToInt( |
| 270 parsed_command_line.GetSwitchValueASCII( | 269 parsed_command_line.GetSwitchValueASCII( |
| 271 switches::kTestingFixedHttpsPort), | 270 switches::kTestingFixedHttpsPort), |
| 272 &value); | 271 &value); |
| 273 net::HttpStreamFactory::set_testing_fixed_https_port(value); | 272 net::HttpStreamFactory::set_testing_fixed_https_port(value); |
| 274 } | 273 } |
| 275 } | 274 } |
| 276 | 275 |
| 277 void InitializeURLRequestThrottlerManager( | |
| 278 const CommandLine& parsed_command_line, | |
| 279 net::NetLog* net_log) { | |
| 280 net::URLRequestThrottlerManager* manager = | |
| 281 net::URLRequestThrottlerManager::GetInstance(); | |
| 282 | |
| 283 // Always done in production, disabled only for unit tests. | |
| 284 manager->set_enable_thread_checks(true); | |
| 285 | |
| 286 if (parsed_command_line.HasSwitch( | |
| 287 switches::kDisableExtensionsHttpThrottling)) { | |
| 288 manager->set_enforce_throttling(false); | |
| 289 } | |
| 290 | |
| 291 // TODO(joi): Passing the NetLog here is temporary; once I switch the | |
| 292 // URLRequestThrottlerManager to be part of the URLRequestContext it will | |
| 293 // come from there. Doing it this way for now (2011/5/12) to try to fail | |
| 294 // fast in case A/B experiment gives unexpected results. | |
| 295 manager->set_net_log(net_log); | |
| 296 } | |
| 297 | |
| 298 // Returns the new local state object, guaranteed non-NULL. | 276 // Returns the new local state object, guaranteed non-NULL. |
| 299 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, | 277 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, |
| 300 bool is_first_run) { | 278 bool is_first_run) { |
| 301 FilePath local_state_path; | 279 FilePath local_state_path; |
| 302 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 280 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 303 bool local_state_file_exists = file_util::PathExists(local_state_path); | 281 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 304 | 282 |
| 305 // Load local state. This includes the application locale so we know which | 283 // Load local state. This includes the application locale so we know which |
| 306 // locale dll to load. | 284 // locale dll to load. |
| 307 PrefService* local_state = g_browser_process->local_state(); | 285 PrefService* local_state = g_browser_process->local_state(); |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 // just changed it to include experiments. | 1349 // just changed it to include experiments. |
| 1372 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 1350 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
| 1373 | 1351 |
| 1374 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 1352 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
| 1375 // Set the product channel for crash reports. | 1353 // Set the product channel for crash reports. |
| 1376 child_process_logging::SetChannel( | 1354 child_process_logging::SetChannel( |
| 1377 chrome::VersionInfo::GetVersionStringModifier()); | 1355 chrome::VersionInfo::GetVersionStringModifier()); |
| 1378 #endif | 1356 #endif |
| 1379 | 1357 |
| 1380 InitializeNetworkOptions(parsed_command_line()); | 1358 InitializeNetworkOptions(parsed_command_line()); |
| 1381 InitializeURLRequestThrottlerManager(parsed_command_line(), | |
| 1382 browser_process_->net_log()); | |
| 1383 | 1359 |
| 1384 // Initialize histogram synchronizer system. This is a singleton and is used | 1360 // Initialize histogram synchronizer system. This is a singleton and is used |
| 1385 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 1361 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
| 1386 // Even though base::Bind does AddRef and Release, the object will not | 1362 // Even though base::Bind does AddRef and Release, the object will not |
| 1387 // be deleted after the Task is executed. | 1363 // be deleted after the Task is executed. |
| 1388 histogram_synchronizer_ = new HistogramSynchronizer(); | 1364 histogram_synchronizer_ = new HistogramSynchronizer(); |
| 1389 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 1365 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
| 1390 | 1366 |
| 1391 // Now that all preferences have been registered, set the install date | 1367 // Now that all preferences have been registered, set the install date |
| 1392 // for the uninstall metrics if this is our first run. This only actually | 1368 // for the uninstall metrics if this is our first run. This only actually |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1984 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2009 uma_name += "_XP"; | 1985 uma_name += "_XP"; |
| 2010 | 1986 |
| 2011 uma_name += "_PreRead_"; | 1987 uma_name += "_PreRead_"; |
| 2012 uma_name += pre_read_percentage; | 1988 uma_name += pre_read_percentage; |
| 2013 AddPreReadHistogramTime(uma_name.c_str(), time); | 1989 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2014 } | 1990 } |
| 2015 #endif | 1991 #endif |
| 2016 #endif | 1992 #endif |
| 2017 } | 1993 } |
| OLD | NEW |