| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 #include "content/public/browser/render_process_host.h" | 108 #include "content/public/browser/render_process_host.h" |
| 109 #include "content/public/common/content_client.h" | 109 #include "content/public/common/content_client.h" |
| 110 #include "content/public/common/main_function_params.h" | 110 #include "content/public/common/main_function_params.h" |
| 111 #include "grit/app_locale_settings.h" | 111 #include "grit/app_locale_settings.h" |
| 112 #include "grit/browser_resources.h" | 112 #include "grit/browser_resources.h" |
| 113 #include "grit/chromium_strings.h" | 113 #include "grit/chromium_strings.h" |
| 114 #include "grit/generated_resources.h" | 114 #include "grit/generated_resources.h" |
| 115 #include "grit/platform_locale_settings.h" | 115 #include "grit/platform_locale_settings.h" |
| 116 #include "net/base/net_module.h" | 116 #include "net/base/net_module.h" |
| 117 #include "net/base/sdch_manager.h" | 117 #include "net/base/sdch_manager.h" |
| 118 #include "net/base/ssl_config_service.h" |
| 118 #include "net/cookies/cookie_monster.h" | 119 #include "net/cookies/cookie_monster.h" |
| 119 #include "net/http/http_basic_stream.h" | 120 #include "net/http/http_basic_stream.h" |
| 120 #include "net/http/http_network_layer.h" | 121 #include "net/http/http_network_layer.h" |
| 121 #include "net/http/http_stream_factory.h" | 122 #include "net/http/http_stream_factory.h" |
| 122 #include "net/socket/client_socket_pool_base.h" | 123 #include "net/socket/client_socket_pool_base.h" |
| 123 #include "net/socket/client_socket_pool_manager.h" | 124 #include "net/socket/client_socket_pool_manager.h" |
| 124 #include "net/spdy/spdy_session.h" | 125 #include "net/spdy/spdy_session.h" |
| 125 #include "net/spdy/spdy_session_pool.h" | 126 #include "net/spdy/spdy_session_pool.h" |
| 126 #include "net/url_request/url_request.h" | 127 #include "net/url_request/url_request.h" |
| 127 #include "net/websockets/websocket_job.h" | 128 #include "net/websockets/websocket_job.h" |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 bool using_hidpi_assets = false; | 1093 bool using_hidpi_assets = false; |
| 1093 #if defined(ENABLE_HIDPI) && defined(OS_WIN) | 1094 #if defined(ENABLE_HIDPI) && defined(OS_WIN) |
| 1094 // Mirrors logic in resource_bundle_win.cc. | 1095 // Mirrors logic in resource_bundle_win.cc. |
| 1095 using_hidpi_assets = ui::GetDPIScale() > 1.5; | 1096 using_hidpi_assets = ui::GetDPIScale() > 1.5; |
| 1096 #endif | 1097 #endif |
| 1097 if (ui::GetDisplayLayout() != ui::LAYOUT_DESKTOP || using_hidpi_assets) | 1098 if (ui::GetDisplayLayout() != ui::LAYOUT_DESKTOP || using_hidpi_assets) |
| 1098 trial->Disable(); | 1099 trial->Disable(); |
| 1099 } | 1100 } |
| 1100 } | 1101 } |
| 1101 | 1102 |
| 1103 void ChromeBrowserMainParts::ChannelIDFieldTrial() { |
| 1104 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1105 if (channel == chrome::VersionInfo::CHANNEL_CANARY) { |
| 1106 net::SSLConfigService::EnableChannelIDTrial(); |
| 1107 } else if (channel == chrome::VersionInfo::CHANNEL_DEV && |
| 1108 base::FieldTrialList::IsOneTimeRandomizationEnabled()) { |
| 1109 const base::FieldTrial::Probability kDivisor = 100; |
| 1110 // 10% probability of being in the enabled group. |
| 1111 const base::FieldTrial::Probability kEnableProbability = 10; |
| 1112 scoped_refptr<base::FieldTrial> trial = |
| 1113 base::FieldTrialList::FactoryGetFieldTrial( |
| 1114 "ChannelID", kDivisor, "disable", 2012, 8, 23, NULL); |
| 1115 trial->UseOneTimeRandomization(); |
| 1116 int enable_group = trial->AppendGroup("enable", kEnableProbability); |
| 1117 if (trial->group() == enable_group) |
| 1118 net::SSLConfigService::EnableChannelIDTrial(); |
| 1119 } |
| 1120 } |
| 1121 |
| 1102 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1122 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
| 1103 | 1123 |
| 1104 void ChromeBrowserMainParts::SetupFieldTrials(bool proxy_policy_is_set) { | 1124 void ChromeBrowserMainParts::SetupFieldTrials(bool proxy_policy_is_set) { |
| 1105 // Note: make sure to call ConnectionFieldTrial() before | 1125 // Note: make sure to call ConnectionFieldTrial() before |
| 1106 // ProxyConnectionsFieldTrial(). | 1126 // ProxyConnectionsFieldTrial(). |
| 1107 ConnectionFieldTrial(); | 1127 ConnectionFieldTrial(); |
| 1108 SocketTimeoutFieldTrial(); | 1128 SocketTimeoutFieldTrial(); |
| 1109 // If a policy is defining the number of active connections this field test | 1129 // If a policy is defining the number of active connections this field test |
| 1110 // shoud not be performed. | 1130 // shoud not be performed. |
| 1111 if (!proxy_policy_is_set) | 1131 if (!proxy_policy_is_set) |
| 1112 ProxyConnectionsFieldTrial(); | 1132 ProxyConnectionsFieldTrial(); |
| 1113 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 1133 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
| 1114 SpdyFieldTrial(); | 1134 SpdyFieldTrial(); |
| 1115 ConnectBackupJobsFieldTrial(); | 1135 ConnectBackupJobsFieldTrial(); |
| 1116 WarmConnectionFieldTrial(); | 1136 WarmConnectionFieldTrial(); |
| 1117 PredictorFieldTrial(); | 1137 PredictorFieldTrial(); |
| 1118 DefaultAppsFieldTrial(); | 1138 DefaultAppsFieldTrial(); |
| 1119 AutoLaunchChromeFieldTrial(); | 1139 AutoLaunchChromeFieldTrial(); |
| 1120 gpu_util::InitializeForceCompositingModeFieldTrial(); | 1140 gpu_util::InitializeForceCompositingModeFieldTrial(); |
| 1121 SetupUniformityFieldTrials(); | 1141 SetupUniformityFieldTrials(); |
| 1122 AutocompleteFieldTrial::Activate(); | 1142 AutocompleteFieldTrial::Activate(); |
| 1123 DisableNewTabFieldTrialIfNecesssary(); | 1143 DisableNewTabFieldTrialIfNecesssary(); |
| 1144 ChannelIDFieldTrial(); |
| 1124 } | 1145 } |
| 1125 | 1146 |
| 1126 void ChromeBrowserMainParts::StartMetricsRecording() { | 1147 void ChromeBrowserMainParts::StartMetricsRecording() { |
| 1127 MetricsService* metrics = g_browser_process->metrics_service(); | 1148 MetricsService* metrics = g_browser_process->metrics_service(); |
| 1128 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) || | 1149 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) || |
| 1129 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) { | 1150 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) { |
| 1130 // If we're testing then we don't care what the user preference is, we turn | 1151 // If we're testing then we don't care what the user preference is, we turn |
| 1131 // on recording, but not reporting, otherwise tests fail. | 1152 // on recording, but not reporting, otherwise tests fail. |
| 1132 metrics->StartRecordingOnly(); | 1153 metrics->StartRecordingOnly(); |
| 1133 return; | 1154 return; |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2079 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2059 uma_name += "_XP"; | 2080 uma_name += "_XP"; |
| 2060 | 2081 |
| 2061 uma_name += "_PreRead_"; | 2082 uma_name += "_PreRead_"; |
| 2062 uma_name += pre_read_percentage; | 2083 uma_name += pre_read_percentage; |
| 2063 AddPreReadHistogramTime(uma_name.c_str(), time); | 2084 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2064 } | 2085 } |
| 2065 #endif | 2086 #endif |
| 2066 #endif | 2087 #endif |
| 2067 } | 2088 } |
| OLD | NEW |