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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 } | 1402 } |
1403 | 1403 |
1404 if (IsAutoReloadEnabled()) | 1404 if (IsAutoReloadEnabled()) |
1405 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); | 1405 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); |
1406 if (IsAutoReloadVisibleOnlyEnabled()) { | 1406 if (IsAutoReloadVisibleOnlyEnabled()) { |
1407 command_line->AppendSwitch( | 1407 command_line->AppendSwitch( |
1408 switches::kEnableOfflineAutoReloadVisibleOnly); | 1408 switches::kEnableOfflineAutoReloadVisibleOnly); |
1409 } | 1409 } |
1410 | 1410 |
1411 { | 1411 { |
1412 // Enable load stale cache if this session is in the field trial or | 1412 // Enable showing a saved copy if this session is in the field trial |
1413 // the user explicitly enabled it. Note that as far as the renderer | 1413 // or the user explicitly enabled it. Note that as far as the |
1414 // is concerned, the feature is enabled if-and-only-if the | 1414 // renderer is concerned, the feature is enabled if-and-only-if |
1415 // kEnableOfflineLoadStaleCache flag is on the command line; | 1415 // one of the kEnableShowSavedCopy* switches is on the command |
1416 // the yes/no/default behavior is only at the browser command line | 1416 // line; the yes/no/default behavior is only at the browser |
1417 // level. | 1417 // command line level. |
1418 | 1418 |
1419 // Command line switches override | 1419 // Command line switches override |
1420 if (browser_command_line.HasSwitch( | 1420 const std::string& show_saved_copy_value = |
1421 switches::kEnableOfflineLoadStaleCache)) { | 1421 browser_command_line.GetSwitchValueASCII(switches::kShowSavedCopy); |
1422 command_line->AppendSwitch(switches::kEnableOfflineLoadStaleCache); | 1422 if (show_saved_copy_value == switches::kEnableShowSavedCopyPrimary || |
1423 } else if (!browser_command_line.HasSwitch( | 1423 show_saved_copy_value == switches::kEnableShowSavedCopySecondary || |
1424 switches::kDisableOfflineLoadStaleCache)) { | 1424 show_saved_copy_value == switches::kDisableShowSavedCopy) { |
| 1425 command_line->AppendSwitchASCII(switches::kShowSavedCopy, |
| 1426 show_saved_copy_value); |
| 1427 } else { |
1425 std::string group = | 1428 std::string group = |
1426 base::FieldTrialList::FindFullName("LoadStaleCacheExperiment"); | 1429 base::FieldTrialList::FindFullName("LoadStaleCacheExperiment"); |
1427 | 1430 |
1428 if (group == "Enabled") | 1431 if (group == "Primary") { |
1429 command_line->AppendSwitch(switches::kEnableOfflineLoadStaleCache); | 1432 command_line->AppendSwitchASCII( |
| 1433 switches::kShowSavedCopy, switches::kEnableShowSavedCopyPrimary); |
| 1434 } else if (group == "Secondary") { |
| 1435 command_line->AppendSwitchASCII( |
| 1436 switches::kShowSavedCopy, |
| 1437 switches::kEnableShowSavedCopySecondary); |
| 1438 } |
1430 } | 1439 } |
1431 } | 1440 } |
1432 | 1441 |
1433 // Please keep this in alphabetical order. | 1442 // Please keep this in alphabetical order. |
1434 static const char* const kSwitchNames[] = { | 1443 static const char* const kSwitchNames[] = { |
1435 autofill::switches::kDisableFillOnAccountSelect, | 1444 autofill::switches::kDisableFillOnAccountSelect, |
1436 autofill::switches::kDisablePasswordGeneration, | 1445 autofill::switches::kDisablePasswordGeneration, |
1437 autofill::switches::kEnableFillOnAccountSelect, | 1446 autofill::switches::kEnableFillOnAccountSelect, |
1438 autofill::switches::kEnableFillOnAccountSelectNoHighlighting, | 1447 autofill::switches::kEnableFillOnAccountSelectNoHighlighting, |
1439 autofill::switches::kEnablePasswordGeneration, | 1448 autofill::switches::kEnablePasswordGeneration, |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2645 switches::kDisableWebRtcEncryption, | 2654 switches::kDisableWebRtcEncryption, |
2646 }; | 2655 }; |
2647 to_command_line->CopySwitchesFrom(from_command_line, | 2656 to_command_line->CopySwitchesFrom(from_command_line, |
2648 kWebRtcDevSwitchNames, | 2657 kWebRtcDevSwitchNames, |
2649 arraysize(kWebRtcDevSwitchNames)); | 2658 arraysize(kWebRtcDevSwitchNames)); |
2650 } | 2659 } |
2651 } | 2660 } |
2652 #endif // defined(ENABLE_WEBRTC) | 2661 #endif // defined(ENABLE_WEBRTC) |
2653 | 2662 |
2654 } // namespace chrome | 2663 } // namespace chrome |
OLD | NEW |