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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 2047683002: Store Origin Trials public key in browser prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; update SetupOriginTrials method name Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index d86da023b2893c426152156b8721e1bf18f82828..c59d5142bb58dc7082ddf4fa3ff7b3a92a81dbe6 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -810,6 +810,19 @@ void ChromeBrowserMainParts::RecordBrowserStartupTime() {
base::TimeTicks::Now(), is_first_run, g_browser_process->local_state());
}
+void ChromeBrowserMainParts::SetupOriginTrialsCommandLine() {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (!command_line->HasSwitch(switches::kOriginTrialPublicKey)) {
+ std::string new_public_key =
+ local_state_->GetString(prefs::kOriginTrialPublicKey);
+ if (!new_public_key.empty()) {
+ command_line->AppendSwitchASCII(
+ switches::kOriginTrialPublicKey,
+ local_state_->GetString(prefs::kOriginTrialPublicKey));
+ }
+ }
+}
+
// -----------------------------------------------------------------------------
// TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts.
@@ -1143,6 +1156,8 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
chromeos::CrosSettings::Initialize();
#endif // defined(OS_CHROMEOS)
+ SetupOriginTrialsCommandLine();
+
// Now the command line has been mutated based on about:flags, we can setup
// metrics and initialize field trials. The field trials are needed by
// IOThread's initialization which happens in BrowserProcess:PreCreateThreads.
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/component_updater/origin_trials_component_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698