Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 | 723 |
| 724 // Create field trials without activating them, so that this behaves in a | 724 // Create field trials without activating them, so that this behaves in a |
| 725 // consistent manner with field trials created from the server. | 725 // consistent manner with field trials created from the server. |
| 726 bool result = base::FieldTrialList::CreateTrialsFromString( | 726 bool result = base::FieldTrialList::CreateTrialsFromString( |
| 727 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), | 727 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), |
| 728 unforceable_field_trials); | 728 unforceable_field_trials); |
| 729 CHECK(result) << "Invalid --" << switches::kForceFieldTrials | 729 CHECK(result) << "Invalid --" << switches::kForceFieldTrials |
| 730 << " list specified."; | 730 << " list specified."; |
| 731 } | 731 } |
| 732 | 732 |
| 733 if (command_line->HasSwitch(switches::kForceVariationIds)) { | |
| 734 // Create default variation ids which will always be included in the | |
| 735 // X-Client-Data request header. | |
| 736 variations::VariationsHttpHeaderProvider* provider = | |
| 737 variations::VariationsHttpHeaderProvider::GetInstance(); | |
| 738 bool result = provider->SetDefaultVariationIds( | |
| 739 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | |
| 740 CHECK(result) << "Invalid --" << switches::kForceVariationIds | |
| 741 << " list specified."; | |
| 742 metrics->AddSyntheticTrialObserver(provider); | |
| 743 } | |
| 744 | |
| 745 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 733 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 746 | 734 |
| 747 // Associate parameters chosen in about:flags and create trial/group for them. | 735 // Associate parameters chosen in about:flags and create trial/group for them. |
| 748 flags_ui::PrefServiceFlagsStorage flags_storage( | 736 flags_ui::PrefServiceFlagsStorage flags_storage( |
| 749 g_browser_process->local_state()); | 737 g_browser_process->local_state()); |
| 750 about_flags::RegisterAllFeatureVariationParameters(&flags_storage, | 738 std::vector<std::string> variation_ids = |
| 751 feature_list.get()); | 739 about_flags::RegisterAllFeatureVariationParameters( |
| 740 &flags_storage, feature_list.get()); | |
| 741 | |
| 742 // Create default variation ids which will always be included in the | |
| 743 // X-Client-Data request header. | |
|
Alexei Svitkine (slow)
2016/07/27 15:04:18
This comment was actually about the command line f
jkrcal
2016/07/27 17:12:43
Done.
| |
| 744 variations::VariationsHttpHeaderProvider* http_header_provider = | |
| 745 variations::VariationsHttpHeaderProvider::GetInstance(); | |
| 746 // Force the variation ids selected in chrome://flags and/or specified using | |
| 747 // the command-line flag. | |
| 748 bool result = http_header_provider->ForceVariationIds( | |
| 749 &variation_ids, | |
| 750 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | |
| 751 CHECK(result) << "Invalid list of variation ids specified (either in --" | |
| 752 << switches::kForceVariationIds << " or in chrome://flags)"; | |
| 753 metrics->AddSyntheticTrialObserver(http_header_provider); | |
| 752 | 754 |
| 753 feature_list->InitializeFromCommandLine( | 755 feature_list->InitializeFromCommandLine( |
| 754 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 756 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 755 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 757 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 756 | 758 |
| 757 #if defined(FIELDTRIAL_TESTING_ENABLED) | 759 #if defined(FIELDTRIAL_TESTING_ENABLED) |
| 758 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && | 760 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && |
| 759 !command_line->HasSwitch(switches::kForceFieldTrials) && | 761 !command_line->HasSwitch(switches::kForceFieldTrials) && |
| 760 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { | 762 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { |
| 761 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); | 763 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2055 chromeos::CrosSettings::Shutdown(); | 2057 chromeos::CrosSettings::Shutdown(); |
| 2056 #endif // defined(OS_CHROMEOS) | 2058 #endif // defined(OS_CHROMEOS) |
| 2057 #endif // defined(OS_ANDROID) | 2059 #endif // defined(OS_ANDROID) |
| 2058 } | 2060 } |
| 2059 | 2061 |
| 2060 // Public members: | 2062 // Public members: |
| 2061 | 2063 |
| 2062 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2064 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2063 chrome_extra_parts_.push_back(parts); | 2065 chrome_extra_parts_.push_back(parts); |
| 2064 } | 2066 } |
| OLD | NEW |