Chromium Code Reviews| Index: chrome/browser/extensions/api/metrics_private/metrics_private_api.cc |
| diff --git a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc |
| index f65d80e80c3f05c015d4071833c830126fd8f2a4..c49722ec8a4c43c3a92126203115c7e8b68088e9 100644 |
| --- a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc |
| +++ b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/common/extensions/api/metrics_private.h" |
| #include "chrome/common/extensions/extension.h" |
| +#include "chrome/common/metrics/variations/variations_associated_data.h" |
| #include "chrome/common/pref_names.h" |
| #include "content/public/browser/user_metrics.h" |
| @@ -76,6 +77,28 @@ bool MetricsPrivateGetFieldTrialFunction::RunImpl() { |
| return true; |
| } |
| +bool MetricsPrivateGetVariationParamsFunction::RunImpl() { |
| + std::string name; |
| + EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name)); |
|
not at google - send to devlin
2013/08/09 18:09:22
prefer using generated code here even if it's simp
vadimt
2013/08/09 19:30:19
Done.
|
| + |
| + std::map<std::string, std::string> params; |
| + if (chrome_variations::GetVariationParams(name, ¶ms)) { |
|
not at google - send to devlin
2013/08/09 18:09:22
early return here, and set an error message on fai
vadimt
2013/08/09 19:30:19
Done.
|
| + scoped_ptr<DictionaryValue> settings(new DictionaryValue()); |
| + |
| + for (std::map<std::string, std::string>::const_iterator it = params.begin(); |
| + it != params.end(); |
| + ++it ) { |
| + settings->SetWithoutPathExpansion( |
|
not at google - send to devlin
2013/08/09 18:09:22
SetStringWithoutPathExpansion
vadimt
2013/08/09 19:30:19
Done.
|
| + it->first, new base::StringValue(it->second)); |
| + } |
| + |
| + SetResult(settings.release()); |
| + return true; |
| + } else { |
| + return false; |
| + } |
| +} |
| + |
| bool MetricsPrivateRecordUserActionFunction::RunImpl() { |
| scoped_ptr<RecordUserAction::Params> params( |
| RecordUserAction::Params::Create(*args_)); |