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

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

Issue 1278403003: Initial implementation of FeatureList in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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 | « base/feature_list_unittest.cc ('k') | chrome/common/chrome_switches.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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/crash_logging.h" 14 #include "base/debug/crash_logging.h"
15 #include "base/debug/debugger.h" 15 #include "base/debug/debugger.h"
16 #include "base/feature_list.h"
16 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
18 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
19 #include "base/metrics/histogram_macros.h" 20 #include "base/metrics/histogram_macros.h"
20 #include "base/path_service.h" 21 #include "base/path_service.h"
21 #include "base/prefs/json_pref_store.h" 22 #include "base/prefs/json_pref_store.h"
22 #include "base/prefs/pref_registry_simple.h" 23 #include "base/prefs/pref_registry_simple.h"
23 #include "base/prefs/pref_service.h" 24 #include "base/prefs/pref_service.h"
24 #include "base/prefs/pref_value_store.h" 25 #include "base/prefs/pref_value_store.h"
25 #include "base/prefs/scoped_user_pref_update.h" 26 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Create default variation ids which will always be included in the 678 // Create default variation ids which will always be included in the
678 // X-Client-Data request header. 679 // X-Client-Data request header.
679 variations::VariationsHttpHeaderProvider* provider = 680 variations::VariationsHttpHeaderProvider* provider =
680 variations::VariationsHttpHeaderProvider::GetInstance(); 681 variations::VariationsHttpHeaderProvider::GetInstance();
681 bool result = provider->SetDefaultVariationIds( 682 bool result = provider->SetDefaultVariationIds(
682 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); 683 command_line->GetSwitchValueASCII(switches::kForceVariationIds));
683 CHECK(result) << "Invalid --" << switches::kForceVariationIds 684 CHECK(result) << "Invalid --" << switches::kForceVariationIds
684 << " list specified."; 685 << " list specified.";
685 metrics->AddSyntheticTrialObserver(provider); 686 metrics->AddSyntheticTrialObserver(provider);
686 } 687 }
688
689 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
690 feature_list->InitializeFromCommandLine(
691 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
692 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
693
687 variations::VariationsService* variations_service = 694 variations::VariationsService* variations_service =
688 browser_process_->variations_service(); 695 browser_process_->variations_service();
689 if (variations_service) 696 if (variations_service)
690 variations_service->CreateTrialsFromSeed(); 697 variations_service->CreateTrialsFromSeed();
691 698
699 // TODO(asvitkine): Pass |feature_list| to CreateTrialsFromSeed() above.
700 base::FeatureList::SetInstance(feature_list.Pass());
701
692 // This must be called after |local_state_| is initialized. 702 // This must be called after |local_state_| is initialized.
693 browser_field_trials_.SetupFieldTrials(); 703 browser_field_trials_.SetupFieldTrials();
694 704
695 // Enable Navigation Tracing only if a trace upload url is specified. 705 // Enable Navigation Tracing only if a trace upload url is specified.
696 if (command_line->HasSwitch(switches::kEnableNavigationTracing) && 706 if (command_line->HasSwitch(switches::kEnableNavigationTracing) &&
697 command_line->HasSwitch(switches::kTraceUploadURL)) { 707 command_line->HasSwitch(switches::kTraceUploadURL)) {
698 tracing::SetupNavigationTracing(); 708 tracing::SetupNavigationTracing();
699 } 709 }
700 710
701 // Initialize FieldTrialSynchronizer system. This is a singleton and is used 711 // Initialize FieldTrialSynchronizer system. This is a singleton and is used
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 chromeos::CrosSettings::Shutdown(); 1848 chromeos::CrosSettings::Shutdown();
1839 #endif // defined(OS_CHROMEOS) 1849 #endif // defined(OS_CHROMEOS)
1840 #endif // defined(OS_ANDROID) 1850 #endif // defined(OS_ANDROID)
1841 } 1851 }
1842 1852
1843 // Public members: 1853 // Public members:
1844 1854
1845 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1855 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1846 chrome_extra_parts_.push_back(parts); 1856 chrome_extra_parts_.push_back(parts);
1847 } 1857 }
OLDNEW
« no previous file with comments | « base/feature_list_unittest.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698