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

Unified Diff: chrome/browser/origin_trials/origin_trial_controller.cc

Issue 1737693002: Allow command-line arguments to override EF public key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix use-after-free due to StringPiece shared state Created 4 years, 10 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/origin_trials/origin_trial_controller.cc
diff --git a/chrome/browser/origin_trials/origin_trial_controller.cc b/chrome/browser/origin_trials/origin_trial_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..519bfba95fccb5c4778c601a1625ef03defee236
--- /dev/null
+++ b/chrome/browser/origin_trials/origin_trial_controller.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/origin_trials/origin_trial_controller.h"
+
+#include <string>
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "components/variations/variations_associated_data.h"
+
+const char OriginTrialController::kFieldTrialName[] = "OriginTrials";
+const char OriginTrialController::kPublicKeyFieldName[] = "PublicKey";
+
+// static
+void OriginTrialController::UpdateCommandLineFromFieldTrials(
+ base::CommandLine* command_line) {
+ std::map<std::string, std::string> field_params;
+ if (!variations::GetVariationParams(kFieldTrialName, &field_params))
+ return;
+
+ std::string override_public_key = field_params[kPublicKeyFieldName];
+ if (!override_public_key.empty()) {
+ command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey,
+ override_public_key);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698