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_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1115 } |
1116 | 1116 |
1117 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( | 1117 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( |
1118 const std::string& alias_name) { | 1118 const std::string& alias_name) { |
1119 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); | 1119 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); |
1120 } | 1120 } |
1121 | 1121 |
1122 namespace { | 1122 namespace { |
1123 | 1123 |
1124 bool IsAutoReloadEnabled() { | 1124 bool IsAutoReloadEnabled() { |
| 1125 // Fetch the field trial, even though we don't use it. Calling FindFullName() |
| 1126 // causes the field-trial mechanism to report which group we're in, which |
| 1127 // might reflect a hard disable or hard enable via flag, both of which have |
| 1128 // their own field trial groups. This lets us know what percentage of users |
| 1129 // manually enable or disable auto-reload. |
1125 std::string group = base::FieldTrialList::FindFullName( | 1130 std::string group = base::FieldTrialList::FindFullName( |
1126 "AutoReloadExperiment"); | 1131 "AutoReloadExperiment"); |
1127 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 1132 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
1128 if (browser_command_line.HasSwitch(switches::kEnableOfflineAutoReload)) | 1133 if (browser_command_line.HasSwitch(switches::kEnableOfflineAutoReload)) |
1129 return true; | 1134 return true; |
1130 if (browser_command_line.HasSwitch(switches::kDisableOfflineAutoReload)) | 1135 if (browser_command_line.HasSwitch(switches::kDisableOfflineAutoReload)) |
1131 return false; | 1136 return false; |
1132 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 1137 return true; |
1133 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
1134 chrome::VersionInfo::Channel kForceChannel = | |
1135 chrome::VersionInfo::CHANNEL_CANARY; | |
1136 return (channel <= kForceChannel || group == "Enabled"); | |
1137 #else | |
1138 return group == "Enabled"; | |
1139 #endif | |
1140 } | 1138 } |
1141 | 1139 |
1142 bool IsAutoReloadVisibleOnlyEnabled() { | 1140 bool IsAutoReloadVisibleOnlyEnabled() { |
| 1141 // See the block comment in IsAutoReloadEnabled(). |
1143 std::string group = base::FieldTrialList::FindFullName( | 1142 std::string group = base::FieldTrialList::FindFullName( |
1144 "AutoReloadVisibleOnlyExperiment"); | 1143 "AutoReloadVisibleOnlyExperiment"); |
1145 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 1144 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
1146 if (browser_command_line.HasSwitch( | 1145 if (browser_command_line.HasSwitch( |
1147 switches::kEnableOfflineAutoReloadVisibleOnly)) { | 1146 switches::kEnableOfflineAutoReloadVisibleOnly)) { |
1148 return true; | 1147 return true; |
1149 } | 1148 } |
1150 if (browser_command_line.HasSwitch( | 1149 if (browser_command_line.HasSwitch( |
1151 switches::kDisableOfflineAutoReloadVisibleOnly)) { | 1150 switches::kDisableOfflineAutoReloadVisibleOnly)) { |
1152 return false; | 1151 return false; |
1153 } | 1152 } |
1154 return group == "Enabled"; | 1153 return true; |
1155 } | 1154 } |
1156 | 1155 |
1157 } // namespace | 1156 } // namespace |
1158 | 1157 |
1159 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( | 1158 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( |
1160 CommandLine* command_line, int child_process_id) { | 1159 CommandLine* command_line, int child_process_id) { |
1161 #if defined(OS_POSIX) | 1160 #if defined(OS_POSIX) |
1162 if (breakpad::IsCrashReporterEnabled()) { | 1161 if (breakpad::IsCrashReporterEnabled()) { |
1163 scoped_ptr<metrics::ClientInfo> client_info = | 1162 scoped_ptr<metrics::ClientInfo> client_info = |
1164 GoogleUpdateSettings::LoadMetricsClientInfo(); | 1163 GoogleUpdateSettings::LoadMetricsClientInfo(); |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 switches::kDisableWebRtcEncryption, | 2595 switches::kDisableWebRtcEncryption, |
2597 }; | 2596 }; |
2598 to_command_line->CopySwitchesFrom(from_command_line, | 2597 to_command_line->CopySwitchesFrom(from_command_line, |
2599 kWebRtcDevSwitchNames, | 2598 kWebRtcDevSwitchNames, |
2600 arraysize(kWebRtcDevSwitchNames)); | 2599 arraysize(kWebRtcDevSwitchNames)); |
2601 } | 2600 } |
2602 } | 2601 } |
2603 #endif // defined(ENABLE_WEBRTC) | 2602 #endif // defined(ENABLE_WEBRTC) |
2604 | 2603 |
2605 } // namespace chrome | 2604 } // namespace chrome |
OLD | NEW |