| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/component_updater/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (!launch_params->GetAsList(¶meter_list) || parameter_list->empty()) { | 202 if (!launch_params->GetAsList(¶meter_list) || parameter_list->empty()) { |
| 203 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); | 203 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); |
| 204 return; | 204 return; |
| 205 } | 205 } |
| 206 | 206 |
| 207 const std::string session_id = GenerateSessionId(); | 207 const std::string session_id = GenerateSessionId(); |
| 208 | 208 |
| 209 safe_browsing::SwReporterQueue invocations; | 209 safe_browsing::SwReporterQueue invocations; |
| 210 for (const auto& iter : *parameter_list) { | 210 for (const auto& iter : *parameter_list) { |
| 211 const base::DictionaryValue* invocation_params = nullptr; | 211 const base::DictionaryValue* invocation_params = nullptr; |
| 212 if (!iter.GetAsDictionary(&invocation_params)) { | 212 if (!iter->GetAsDictionary(&invocation_params)) { |
| 213 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); | 213 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); |
| 214 return; | 214 return; |
| 215 } | 215 } |
| 216 | 216 |
| 217 // Max length of the registry and histogram suffix. Fairly arbitrary: the | 217 // Max length of the registry and histogram suffix. Fairly arbitrary: the |
| 218 // Windows registry accepts much longer keys, but we need to display this | 218 // Windows registry accepts much longer keys, but we need to display this |
| 219 // string in histograms as well. | 219 // string in histograms as well. |
| 220 constexpr size_t kMaxSuffixLength = 80; | 220 constexpr size_t kMaxSuffixLength = 80; |
| 221 | 221 |
| 222 // The suffix must be an alphanumeric string. (Empty is fine as long as the | 222 // The suffix must be an alphanumeric string. (Empty is fine as long as the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 233 // it's ok if it's an empty list or a list of empty strings.) | 233 // it's ok if it's an empty list or a list of empty strings.) |
| 234 const base::ListValue* arguments = nullptr; | 234 const base::ListValue* arguments = nullptr; |
| 235 if (!invocation_params->GetList("arguments", &arguments)) { | 235 if (!invocation_params->GetList("arguments", &arguments)) { |
| 236 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); | 236 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 std::vector<base::string16> argv = {exe_path.value()}; | 240 std::vector<base::string16> argv = {exe_path.value()}; |
| 241 for (const auto& value : *arguments) { | 241 for (const auto& value : *arguments) { |
| 242 base::string16 argument; | 242 base::string16 argument; |
| 243 if (!value.GetAsString(&argument)) { | 243 if (!value->GetAsString(&argument)) { |
| 244 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); | 244 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); |
| 245 return; | 245 return; |
| 246 } | 246 } |
| 247 if (!argument.empty()) | 247 if (!argument.empty()) |
| 248 argv.push_back(argument); | 248 argv.push_back(argument); |
| 249 } | 249 } |
| 250 | 250 |
| 251 base::CommandLine command_line(argv); | 251 base::CommandLine command_line(argv); |
| 252 | 252 |
| 253 // Add a random session id to link experimental reporter runs together. | 253 // Add a random session id to link experimental reporter runs together. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 495 } |
| 496 | 496 |
| 497 void RegisterProfilePrefsForSwReporter( | 497 void RegisterProfilePrefsForSwReporter( |
| 498 user_prefs::PrefRegistrySyncable* registry) { | 498 user_prefs::PrefRegistrySyncable* registry) { |
| 499 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); | 499 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); |
| 500 | 500 |
| 501 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); | 501 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); |
| 502 } | 502 } |
| 503 | 503 |
| 504 } // namespace component_updater | 504 } // namespace component_updater |
| OLD | NEW |