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

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 comments #2 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
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Force the variation ids selected in chrome://flags and/or specified using
743 // the command-line flag.
744 variations::VariationsHttpHeaderProvider* http_header_provider =
745 variations::ForceVariationIDsForHttpHeaders(
746 variation_ids,
747 command_line->GetSwitchValueASCII(switches::kForceVariationIds));
748 if (http_header_provider)
749 metrics->AddSyntheticTrialObserver(http_header_provider);
752 750
753 feature_list->InitializeFromCommandLine( 751 feature_list->InitializeFromCommandLine(
754 command_line->GetSwitchValueASCII(switches::kEnableFeatures), 752 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
755 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); 753 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
756 754
757 #if defined(FIELDTRIAL_TESTING_ENABLED) 755 #if defined(FIELDTRIAL_TESTING_ENABLED)
758 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && 756 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) &&
759 !command_line->HasSwitch(switches::kForceFieldTrials) && 757 !command_line->HasSwitch(switches::kForceFieldTrials) &&
760 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { 758 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) {
761 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); 759 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get());
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 chromeos::CrosSettings::Shutdown(); 2053 chromeos::CrosSettings::Shutdown();
2056 #endif // defined(OS_CHROMEOS) 2054 #endif // defined(OS_CHROMEOS)
2057 #endif // defined(OS_ANDROID) 2055 #endif // defined(OS_ANDROID)
2058 } 2056 }
2059 2057
2060 // Public members: 2058 // Public members:
2061 2059
2062 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2060 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2063 chrome_extra_parts_.push_back(parts); 2061 chrome_extra_parts_.push_back(parts);
2064 } 2062 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698