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 <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/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 18 #include "base/metrics/feature_list.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" |
26 #include "base/profiler/scoped_profile.h" | 27 #include "base/profiler/scoped_profile.h" |
27 #include "base/profiler/scoped_tracker.h" | 28 #include "base/profiler/scoped_tracker.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // Create default variation ids which will always be included in the | 671 // Create default variation ids which will always be included in the |
671 // X-Client-Data request header. | 672 // X-Client-Data request header. |
672 variations::VariationsHttpHeaderProvider* provider = | 673 variations::VariationsHttpHeaderProvider* provider = |
673 variations::VariationsHttpHeaderProvider::GetInstance(); | 674 variations::VariationsHttpHeaderProvider::GetInstance(); |
674 bool result = provider->SetDefaultVariationIds( | 675 bool result = provider->SetDefaultVariationIds( |
675 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | 676 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); |
676 CHECK(result) << "Invalid --" << switches::kForceVariationIds | 677 CHECK(result) << "Invalid --" << switches::kForceVariationIds |
677 << " list specified."; | 678 << " list specified."; |
678 metrics->AddSyntheticTrialObserver(provider); | 679 metrics->AddSyntheticTrialObserver(provider); |
679 } | 680 } |
| 681 |
| 682 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 683 feature_list->InitializeFromCommandLine( |
| 684 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 685 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 686 |
680 chrome_variations::VariationsService* variations_service = | 687 chrome_variations::VariationsService* variations_service = |
681 browser_process_->variations_service(); | 688 browser_process_->variations_service(); |
682 if (variations_service) | 689 if (variations_service) |
683 variations_service->CreateTrialsFromSeed(); | 690 variations_service->CreateTrialsFromSeed(); |
684 | 691 |
| 692 // TODO(asvitkine): Pass |feature_list| to CreateTrialsFromSeed() above. |
| 693 base::FeatureList::SetInstance(feature_list.Pass()); |
| 694 |
685 // This must be called after |local_state_| is initialized. | 695 // This must be called after |local_state_| is initialized. |
686 browser_field_trials_.SetupFieldTrials(); | 696 browser_field_trials_.SetupFieldTrials(); |
687 | 697 |
688 // Enable Navigation Tracing only if a trace upload url is specified. | 698 // Enable Navigation Tracing only if a trace upload url is specified. |
689 if (command_line->HasSwitch(switches::kEnableNavigationTracing) && | 699 if (command_line->HasSwitch(switches::kEnableNavigationTracing) && |
690 command_line->HasSwitch(switches::kTraceUploadURL)) { | 700 command_line->HasSwitch(switches::kTraceUploadURL)) { |
691 tracing::SetupNavigationTracing(); | 701 tracing::SetupNavigationTracing(); |
692 } | 702 } |
693 | 703 |
694 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 704 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 chromeos::CrosSettings::Shutdown(); | 1821 chromeos::CrosSettings::Shutdown(); |
1812 #endif // defined(OS_CHROMEOS) | 1822 #endif // defined(OS_CHROMEOS) |
1813 #endif // defined(OS_ANDROID) | 1823 #endif // defined(OS_ANDROID) |
1814 } | 1824 } |
1815 | 1825 |
1816 // Public members: | 1826 // Public members: |
1817 | 1827 |
1818 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1828 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1819 chrome_extra_parts_.push_back(parts); | 1829 chrome_extra_parts_.push_back(parts); |
1820 } | 1830 } |
OLD | NEW |