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