| OLD | NEW | 
|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chrome/browser/origin_trials/origin_trial_controller.h" | 5 #include "chrome/browser/origin_trials/origin_trial_controller.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" | 
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" | 
| 11 #include "components/variations/variations_associated_data.h" | 11 #include "components/variations/variations_associated_data.h" | 
| 12 | 12 | 
| 13 const char OriginTrialController::kFieldTrialName[] = "OriginTrials"; | 13 const char OriginTrialController::kFieldTrialName[] = "OriginTrials"; | 
| 14 const char OriginTrialController::kPublicKeyFieldName[] = "PublicKey"; | 14 const char OriginTrialController::kPublicKeyFieldName[] = "PublicKey"; | 
|  | 15 const char OriginTrialController::kDisabledFeaturesFieldName[] = | 
|  | 16     "DisabledFeatures"; | 
| 15 | 17 | 
| 16 // static | 18 // static | 
| 17 void OriginTrialController::UpdateCommandLineFromFieldTrials( | 19 void OriginTrialController::UpdateCommandLineFromFieldTrials( | 
| 18     base::CommandLine* command_line) { | 20     base::CommandLine* command_line) { | 
| 19   std::map<std::string, std::string> field_params; | 21   std::map<std::string, std::string> field_params; | 
| 20   if (!variations::GetVariationParams(kFieldTrialName, &field_params)) | 22   if (!variations::GetVariationParams(kFieldTrialName, &field_params)) | 
| 21     return; | 23     return; | 
| 22 | 24 | 
| 23   std::string override_public_key = field_params[kPublicKeyFieldName]; | 25   std::string override_public_key = field_params[kPublicKeyFieldName]; | 
| 24   if (!override_public_key.empty()) { | 26   if (!override_public_key.empty()) { | 
| 25     command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey, | 27     command_line->AppendSwitchASCII(switches::kOriginTrialPublicKey, | 
| 26                                     override_public_key); | 28                                     override_public_key); | 
| 27   } | 29   } | 
|  | 30   std::string disabled_feature_list = field_params[kDisabledFeaturesFieldName]; | 
|  | 31   if (!disabled_feature_list.empty()) { | 
|  | 32     command_line->AppendSwitchASCII(switches::kOriginTrialDisabledFeatures, | 
|  | 33                                     disabled_feature_list); | 
|  | 34   } | 
| 28 } | 35 } | 
| OLD | NEW | 
|---|