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

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

Issue 2036193002: Allow overriding variation parameter via chrome://flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After code review Created 4 years, 6 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // X-Client-Data request header. 709 // X-Client-Data request header.
710 variations::VariationsHttpHeaderProvider* provider = 710 variations::VariationsHttpHeaderProvider* provider =
711 variations::VariationsHttpHeaderProvider::GetInstance(); 711 variations::VariationsHttpHeaderProvider::GetInstance();
712 bool result = provider->SetDefaultVariationIds( 712 bool result = provider->SetDefaultVariationIds(
713 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); 713 command_line->GetSwitchValueASCII(switches::kForceVariationIds));
714 CHECK(result) << "Invalid --" << switches::kForceVariationIds 714 CHECK(result) << "Invalid --" << switches::kForceVariationIds
715 << " list specified."; 715 << " list specified.";
716 metrics->AddSyntheticTrialObserver(provider); 716 metrics->AddSyntheticTrialObserver(provider);
717 } 717 }
718 718
719 // Associate parameters chosen in about:flags and create trial/group for them.
720 flags_ui::PrefServiceFlagsStorage flags_storage(
721 g_browser_process->local_state());
722 about_flags::RegisterAllFeatureVariationParameters(&flags_storage);
723
719 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 724 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
720 feature_list->InitializeFromCommandLine( 725 feature_list->InitializeFromCommandLine(
721 command_line->GetSwitchValueASCII(switches::kEnableFeatures), 726 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
722 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); 727 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
723 728
724 #if defined(FIELDTRIAL_TESTING_ENABLED) 729 #if defined(FIELDTRIAL_TESTING_ENABLED)
725 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && 730 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) &&
726 !command_line->HasSwitch(switches::kForceFieldTrials) && 731 !command_line->HasSwitch(switches::kForceFieldTrials) &&
727 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { 732 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) {
728 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); 733 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get());
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 966
962 #if !defined(OS_CHROMEOS) 967 #if !defined(OS_CHROMEOS)
963 // Convert active labs into switches. This needs to be done before 968 // Convert active labs into switches. This needs to be done before
964 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are 969 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are
965 // affected by experiment flags (--touch-optimized-ui in particular). 970 // affected by experiment flags (--touch-optimized-ui in particular).
966 // On ChromeOS system level flags are applied from the device settings from 971 // On ChromeOS system level flags are applied from the device settings from
967 // the session manager. 972 // the session manager.
968 { 973 {
969 TRACE_EVENT0("startup", 974 TRACE_EVENT0("startup",
970 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags"); 975 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags");
971 flags_ui::PrefServiceFlagsStorage flags_storage_( 976 flags_ui::PrefServiceFlagsStorage flags_storage(
972 g_browser_process->local_state()); 977 g_browser_process->local_state());
973 about_flags::ConvertFlagsToSwitches(&flags_storage_, 978 about_flags::ConvertFlagsToSwitches(&flags_storage,
974 base::CommandLine::ForCurrentProcess(), 979 base::CommandLine::ForCurrentProcess(),
975 flags_ui::kAddSentinels); 980 flags_ui::kAddSentinels);
976 } 981 }
977 #endif // !defined(OS_CHROMEOS) 982 #endif // !defined(OS_CHROMEOS)
978 // The MaterialDesignController needs to look at command line flags, which 983 // The MaterialDesignController needs to look at command line flags, which
979 // are not available until this point. Now that they are, proceed with 984 // are not available until this point. Now that they are, proceed with
980 // initializing the MaterialDesignController. 985 // initializing the MaterialDesignController.
981 ui::MaterialDesignController::Initialize(); 986 ui::MaterialDesignController::Initialize();
982 #if defined(OS_CHROMEOS) 987 #if defined(OS_CHROMEOS)
983 ash::MaterialDesignController::Initialize(); 988 ash::MaterialDesignController::Initialize();
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 chromeos::CrosSettings::Shutdown(); 1988 chromeos::CrosSettings::Shutdown();
1984 #endif // defined(OS_CHROMEOS) 1989 #endif // defined(OS_CHROMEOS)
1985 #endif // defined(OS_ANDROID) 1990 #endif // defined(OS_ANDROID)
1986 } 1991 }
1987 1992
1988 // Public members: 1993 // Public members:
1989 1994
1990 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1995 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1991 chrome_extra_parts_.push_back(parts); 1996 chrome_extra_parts_.push_back(parts);
1992 } 1997 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698