| Index: components/variations/study_filtering.cc
|
| diff --git a/components/variations/study_filtering.cc b/components/variations/study_filtering.cc
|
| index 479b9e959ec413d098e1345eb789dca144172c3b..159b544f4e7d388e0fc3c49d251a82e8381af48a 100644
|
| --- a/components/variations/study_filtering.cc
|
| +++ b/components/variations/study_filtering.cc
|
| @@ -106,15 +106,18 @@ bool CheckStudyHardwareClass(const Study_Filter& filter,
|
| }
|
|
|
| bool CheckStudyLocale(const Study_Filter& filter, const std::string& locale) {
|
| - // An empty locale list matches all locales.
|
| - if (filter.locale_size() == 0)
|
| + // Empty locale and exclude_locale lists matches all locales.
|
| + if (filter.locale_size() == 0 && filter.exclude_locale_size() == 0)
|
| return true;
|
|
|
| - for (int i = 0; i < filter.locale_size(); ++i) {
|
| - if (filter.locale(i) == locale)
|
| - return true;
|
| - }
|
| - return false;
|
| + // Check if we are supposed to filter for a specified set of countries. Note
|
| + // that this means this overrides the exclude_locale in case that ever occurs
|
| + // (which it shouldn't).
|
| + if (filter.locale_size() > 0)
|
| + return base::ContainsValue(filter.locale(), locale);
|
| +
|
| + // Omit if matches any of the exclude entries.
|
| + return !base::ContainsValue(filter.exclude_locale(), locale);
|
| }
|
|
|
| bool CheckStudyPlatform(const Study_Filter& filter, Study_Platform platform) {
|
|
|