| 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..10530d9ce68a0fdb63db63506959e82e5521d968
|
| --- /dev/null
|
| +++ b/chrome/browser/origin_trials/origin_trial_controller.cc
|
| @@ -0,0 +1,30 @@
|
| +// 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 "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) {
|
| + DCHECK(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.size()) {
|
| + command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey,
|
| + override_public_key);
|
| + }
|
| +}
|
|
|