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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 // doesn't know if this is the first run. This will cause some inaccuracy in | 803 // doesn't know if this is the first run. This will cause some inaccuracy in |
804 // the UMA statistics, but this should be minor (first runs are rare). | 804 // the UMA statistics, but this should be minor (first runs are rare). |
805 is_first_run = first_run::IsChromeFirstRun(); | 805 is_first_run = first_run::IsChromeFirstRun(); |
806 #endif // defined(OS_ANDROID) | 806 #endif // defined(OS_ANDROID) |
807 | 807 |
808 // Record collected startup metrics. | 808 // Record collected startup metrics. |
809 startup_metric_utils::RecordBrowserMainMessageLoopStart( | 809 startup_metric_utils::RecordBrowserMainMessageLoopStart( |
810 base::TimeTicks::Now(), is_first_run, g_browser_process->local_state()); | 810 base::TimeTicks::Now(), is_first_run, g_browser_process->local_state()); |
811 } | 811 } |
812 | 812 |
| 813 void ChromeBrowserMainParts::SetupOriginTrialsCommandLine() { |
| 814 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 815 if (!command_line->HasSwitch(switches::kOriginTrialPublicKey)) { |
| 816 std::string new_public_key = |
| 817 local_state_->GetString(prefs::kOriginTrialPublicKey); |
| 818 if (!new_public_key.empty()) { |
| 819 command_line->AppendSwitchASCII( |
| 820 switches::kOriginTrialPublicKey, |
| 821 local_state_->GetString(prefs::kOriginTrialPublicKey)); |
| 822 } |
| 823 } |
| 824 } |
| 825 |
813 // ----------------------------------------------------------------------------- | 826 // ----------------------------------------------------------------------------- |
814 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. | 827 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. |
815 | 828 |
816 #if defined(OS_WIN) | 829 #if defined(OS_WIN) |
817 #define DLLEXPORT __declspec(dllexport) | 830 #define DLLEXPORT __declspec(dllexport) |
818 | 831 |
819 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 832 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
820 extern "C" { | 833 extern "C" { |
821 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 834 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
822 } | 835 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 // any callbacks, I just want to initialize the mechanism.) | 1149 // any callbacks, I just want to initialize the mechanism.) |
1137 SecKeychainAddCallback(&KeychainCallback, 0, NULL); | 1150 SecKeychainAddCallback(&KeychainCallback, 0, NULL); |
1138 #endif // defined(OS_MACOSX) | 1151 #endif // defined(OS_MACOSX) |
1139 | 1152 |
1140 #if defined(OS_CHROMEOS) | 1153 #if defined(OS_CHROMEOS) |
1141 // Must be done after g_browser_process is constructed, before | 1154 // Must be done after g_browser_process is constructed, before |
1142 // SetupMetricsAndFieldTrials(). | 1155 // SetupMetricsAndFieldTrials(). |
1143 chromeos::CrosSettings::Initialize(); | 1156 chromeos::CrosSettings::Initialize(); |
1144 #endif // defined(OS_CHROMEOS) | 1157 #endif // defined(OS_CHROMEOS) |
1145 | 1158 |
| 1159 SetupOriginTrialsCommandLine(); |
| 1160 |
1146 // Now the command line has been mutated based on about:flags, we can setup | 1161 // Now the command line has been mutated based on about:flags, we can setup |
1147 // metrics and initialize field trials. The field trials are needed by | 1162 // metrics and initialize field trials. The field trials are needed by |
1148 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 1163 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
1149 SetupMetricsAndFieldTrials(); | 1164 SetupMetricsAndFieldTrials(); |
1150 | 1165 |
1151 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1166 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
1152 browser_process_->PreCreateThreads(); | 1167 browser_process_->PreCreateThreads(); |
1153 | 1168 |
1154 return content::RESULT_CODE_NORMAL_EXIT; | 1169 return content::RESULT_CODE_NORMAL_EXIT; |
1155 } | 1170 } |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 chromeos::CrosSettings::Shutdown(); | 2005 chromeos::CrosSettings::Shutdown(); |
1991 #endif // defined(OS_CHROMEOS) | 2006 #endif // defined(OS_CHROMEOS) |
1992 #endif // defined(OS_ANDROID) | 2007 #endif // defined(OS_ANDROID) |
1993 } | 2008 } |
1994 | 2009 |
1995 // Public members: | 2010 // Public members: |
1996 | 2011 |
1997 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2012 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1998 chrome_extra_parts_.push_back(parts); | 2013 chrome_extra_parts_.push_back(parts); |
1999 } | 2014 } |
OLD | NEW |