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

Unified Diff: chrome/browser/component_updater/origin_trials_component_installer.cc

Issue 2047683002: Store Origin Trials public key in browser prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/component_updater/origin_trials_component_installer.cc
diff --git a/chrome/browser/component_updater/origin_trials_component_installer.cc b/chrome/browser/component_updater/origin_trials_component_installer.cc
index a32d62a3c4c6fd9e2429c1c01717a6ca488a476f..b8a2ec7d6896ffdcfafdb3638aa614b57530fc13 100644
--- a/chrome/browser/component_updater/origin_trials_component_installer.cc
+++ b/chrome/browser/component_updater/origin_trials_component_installer.cc
@@ -8,8 +8,11 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
+#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_switches.h"
#include "components/component_updater/component_updater_paths.h"
+#include "components/prefs/pref_service.h"
// The client-side configuration for the origin trial framework can be
// overridden by an installed component named 'OriginTrials' (extension id
@@ -65,12 +68,13 @@ void OriginTrialsComponentInstallerTraits::ComponentReady(
const base::Version& version,
const base::FilePath& install_dir,
std::unique_ptr<base::DictionaryValue> manifest) {
- // Read the public key from the manifest and set the command line.
+ // Read the public key from the manifest and set values in browser
+ // local_state. These will be used on the next browser restart.
+ PrefService* local_state = g_browser_process->local_state();
std::string override_public_key;
if (manifest->GetString("origin-trials.public-key", &override_public_key)) {
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey,
- override_public_key);
+ local_state->Set("origin-trials.public-key",
chasej 2016/06/07 15:09:40 Can this use the prefs::kOriginTrialPublicKey cons
iclelland 2016/06/08 02:48:22 It absolutely can, and should. Thanks. Done.
+ base::StringValue(override_public_key));
}
}

Powered by Google App Engine
This is Rietveld 408576698