Chromium Code Reviews| 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..fe39de758f15f243284b3d1b8a27519c3f0d1402 |
| --- /dev/null |
| +++ b/chrome/browser/origin_trials/origin_trial_controller.cc |
| @@ -0,0 +1,31 @@ |
| +// 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) { |
| + DCHECK(command_line); |
|
Alexei Svitkine (slow)
2016/02/26 16:29:08
Nit: Not needed.
iclelland
2016/02/26 19:55:04
Removed.
|
| + |
| + std::map<std::string, std::string> field_params; |
| + if (!variations::GetVariationParams(kFieldTrialName, &field_params)) { |
|
Alexei Svitkine (slow)
2016/02/26 16:29:08
Nit: No {}'s
iclelland
2016/02/26 19:55:04
Thanks; these were all leftovers from my in-develo
|
| + return; |
| + } |
| + |
| + std::string override_public_key = field_params[kPublicKeyFieldName]; |
| + if (override_public_key.size()) { |
|
Alexei Svitkine (slow)
2016/02/26 16:29:08
Nit: !.empty()
iclelland
2016/02/26 19:55:04
Done.
|
| + command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey, |
| + override_public_key); |
|
Alexei Svitkine (slow)
2016/02/26 16:29:08
I'm not a big fan of plumbing this through the com
iclelland
2016/02/26 16:49:14
I wrote the command-line handling code first, as a
Alexei Svitkine (slow)
2016/02/26 17:32:20
Ah, you're right - I missed that you're checking i
|
| + } |
| +} |