| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 // X-Client-Data request header. | 711 // X-Client-Data request header. |
| 712 variations::VariationsHttpHeaderProvider* provider = | 712 variations::VariationsHttpHeaderProvider* provider = |
| 713 variations::VariationsHttpHeaderProvider::GetInstance(); | 713 variations::VariationsHttpHeaderProvider::GetInstance(); |
| 714 bool result = provider->SetDefaultVariationIds( | 714 bool result = provider->SetDefaultVariationIds( |
| 715 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | 715 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); |
| 716 CHECK(result) << "Invalid --" << switches::kForceVariationIds | 716 CHECK(result) << "Invalid --" << switches::kForceVariationIds |
| 717 << " list specified."; | 717 << " list specified."; |
| 718 metrics->AddSyntheticTrialObserver(provider); | 718 metrics->AddSyntheticTrialObserver(provider); |
| 719 } | 719 } |
| 720 | 720 |
| 721 // Associate parameters chosen in about:flags and create trial/group for them. |
| 722 flags_ui::PrefServiceFlagsStorage flags_storage( |
| 723 g_browser_process->local_state()); |
| 724 about_flags::RegisterAllFeatureVariationParameters(&flags_storage); |
| 725 |
| 721 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 726 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 722 feature_list->InitializeFromCommandLine( | 727 feature_list->InitializeFromCommandLine( |
| 723 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 728 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 724 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 729 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 725 | 730 |
| 726 #if defined(FIELDTRIAL_TESTING_ENABLED) | 731 #if defined(FIELDTRIAL_TESTING_ENABLED) |
| 727 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && | 732 if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && |
| 728 !command_line->HasSwitch(switches::kForceFieldTrials) && | 733 !command_line->HasSwitch(switches::kForceFieldTrials) && |
| 729 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { | 734 !command_line->HasSwitch(variations::switches::kVariationsServerURL)) { |
| 730 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); | 735 chrome_variations::AssociateDefaultFieldTrialConfig(feature_list.get()); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 | 968 |
| 964 #if !defined(OS_CHROMEOS) | 969 #if !defined(OS_CHROMEOS) |
| 965 // Convert active labs into switches. This needs to be done before | 970 // Convert active labs into switches. This needs to be done before |
| 966 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are | 971 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are |
| 967 // affected by experiment flags (--touch-optimized-ui in particular). | 972 // affected by experiment flags (--touch-optimized-ui in particular). |
| 968 // On ChromeOS system level flags are applied from the device settings from | 973 // On ChromeOS system level flags are applied from the device settings from |
| 969 // the session manager. | 974 // the session manager. |
| 970 { | 975 { |
| 971 TRACE_EVENT0("startup", | 976 TRACE_EVENT0("startup", |
| 972 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags"); | 977 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags"); |
| 973 flags_ui::PrefServiceFlagsStorage flags_storage_( | 978 flags_ui::PrefServiceFlagsStorage flags_storage( |
| 974 g_browser_process->local_state()); | 979 g_browser_process->local_state()); |
| 975 about_flags::ConvertFlagsToSwitches(&flags_storage_, | 980 about_flags::ConvertFlagsToSwitches(&flags_storage, |
| 976 base::CommandLine::ForCurrentProcess(), | 981 base::CommandLine::ForCurrentProcess(), |
| 977 flags_ui::kAddSentinels); | 982 flags_ui::kAddSentinels); |
| 978 } | 983 } |
| 979 #endif // !defined(OS_CHROMEOS) | 984 #endif // !defined(OS_CHROMEOS) |
| 980 // The MaterialDesignController needs to look at command line flags, which | 985 // The MaterialDesignController needs to look at command line flags, which |
| 981 // are not available until this point. Now that they are, proceed with | 986 // are not available until this point. Now that they are, proceed with |
| 982 // initializing the MaterialDesignController. | 987 // initializing the MaterialDesignController. |
| 983 ui::MaterialDesignController::Initialize(); | 988 ui::MaterialDesignController::Initialize(); |
| 984 #if defined(OS_CHROMEOS) | 989 #if defined(OS_CHROMEOS) |
| 985 ash::MaterialDesignController::Initialize(); | 990 ash::MaterialDesignController::Initialize(); |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 chromeos::CrosSettings::Shutdown(); | 1998 chromeos::CrosSettings::Shutdown(); |
| 1994 #endif // defined(OS_CHROMEOS) | 1999 #endif // defined(OS_CHROMEOS) |
| 1995 #endif // defined(OS_ANDROID) | 2000 #endif // defined(OS_ANDROID) |
| 1996 } | 2001 } |
| 1997 | 2002 |
| 1998 // Public members: | 2003 // Public members: |
| 1999 | 2004 |
| 2000 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2005 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2001 chrome_extra_parts_.push_back(parts); | 2006 chrome_extra_parts_.push_back(parts); |
| 2002 } | 2007 } |
| OLD | NEW |