Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 2182553002: Add other variations (with ids) for NTPSnippets to chrome://flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei's comment #5 + fix a bug Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/flags_ui/feature_entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 727
728 // Create field trials without activating them, so that this behaves in a 728 // Create field trials without activating them, so that this behaves in a
729 // consistent manner with field trials created from the server. 729 // consistent manner with field trials created from the server.
730 bool result = base::FieldTrialList::CreateTrialsFromString( 730 bool result = base::FieldTrialList::CreateTrialsFromString(
731 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), 731 command_line->GetSwitchValueASCII(switches::kForceFieldTrials),
732 unforceable_field_trials); 732 unforceable_field_trials);
733 CHECK(result) << "Invalid --" << switches::kForceFieldTrials 733 CHECK(result) << "Invalid --" << switches::kForceFieldTrials
734 << " list specified."; 734 << " list specified.";
735 } 735 }
736 736
737 if (command_line->HasSwitch(switches::kForceVariationIds)) {
738 // Create default variation ids which will always be included in the
739 // X-Client-Data request header.
740 variations::VariationsHttpHeaderProvider* provider =
741 variations::VariationsHttpHeaderProvider::GetInstance();
742 bool result = provider->SetDefaultVariationIds(
743 command_line->GetSwitchValueASCII(switches::kForceVariationIds));
744 CHECK(result) << "Invalid --" << switches::kForceVariationIds
745 << " list specified.";
746 metrics->AddSyntheticTrialObserver(provider);
747 }
748
749 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 737 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
750 738
751 // Associate parameters chosen in about:flags and create trial/group for them. 739 // Associate parameters chosen in about:flags and create trial/group for them.
752 flags_ui::PrefServiceFlagsStorage flags_storage( 740 flags_ui::PrefServiceFlagsStorage flags_storage(
753 g_browser_process->local_state()); 741 g_browser_process->local_state());
754 about_flags::RegisterAllFeatureVariationParameters(&flags_storage, 742 std::vector<std::string> variation_ids =
755 feature_list.get()); 743 about_flags::RegisterAllFeatureVariationParameters(
744 &flags_storage, feature_list.get());
745
746 variations::VariationsHttpHeaderProvider* http_header_provider =
747 variations::VariationsHttpHeaderProvider::GetInstance();
748 // Force the variation ids selected in chrome://flags and/or specified using
749 // the command-line flag.
750 bool result = http_header_provider->ForceVariationIds(
751 command_line->GetSwitchValueASCII(switches::kForceVariationIds),
752 &variation_ids);
753 CHECK(result) << "Invalid list of variation ids specified (either in --"
754 << switches::kForceVariationIds << " or in chrome://flags)";
755 metrics->AddSyntheticTrialObserver(http_header_provider);
756 756
757 feature_list->InitializeFromCommandLine( 757 feature_list->InitializeFromCommandLine(
758 command_line->GetSwitchValueASCII(switches::kEnableFeatures), 758 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
759 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); 759 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
760 760
761 #if defined(FIELDTRIAL_TESTING_ENABLED) 761 #if defined(FIELDTRIAL_TESTING_ENABLED)
762 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && 762 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) &&
763 !command_line->HasSwitch(switches::kForceFieldTrials) && 763 !command_line->HasSwitch(switches::kForceFieldTrials) &&
764 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { 764 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) {
765 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); 765 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get());
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 chromeos::CrosSettings::Shutdown(); 2072 chromeos::CrosSettings::Shutdown();
2073 #endif // defined(OS_CHROMEOS) 2073 #endif // defined(OS_CHROMEOS)
2074 #endif // defined(OS_ANDROID) 2074 #endif // defined(OS_ANDROID)
2075 } 2075 }
2076 2076
2077 // Public members: 2077 // Public members:
2078 2078
2079 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2079 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2080 chrome_extra_parts_.push_back(parts); 2080 chrome_extra_parts_.push_back(parts);
2081 } 2081 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/flags_ui/feature_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698