Chromium Code Reviews| Index: chrome/browser/metrics/variations/variations_service.cc |
| diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc |
| index b4e12da5b1bb716dbe4b3ddb0f88b9d6b3ae6461..7fdf5f46c9e62519d1f03f2f18d8b352c43da387 100644 |
| --- a/chrome/browser/metrics/variations/variations_service.cc |
| +++ b/chrome/browser/metrics/variations/variations_service.cc |
| @@ -277,12 +277,35 @@ bool VariationsService::StoreSeedData(const std::string& seed_data, |
| } |
| // static |
| +chrome::VersionInfo::Channel VariationsService::GetChannelForVariations() { |
|
Alexei Svitkine (slow)
2013/01/04 19:56:34
Stick this in an anon namespace, since this isn't
SteveT
2013/01/04 20:09:47
Moved.
|
| + chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| + if (channel != chrome::VersionInfo::CHANNEL_UNKNOWN) |
| + return channel; |
| + std::string forced_channel = |
| + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + switches::kFakeVariationsChannel); |
| + if (!forced_channel.empty()) { |
|
Alexei Svitkine (slow)
2013/01/04 19:56:34
Why this check?
SteveT
2013/01/04 20:09:47
We won't need this anymore with the logging below.
|
| + if (forced_channel == "stable") |
| + channel = chrome::VersionInfo::CHANNEL_STABLE; |
| + else if (forced_channel == "beta") |
| + channel = chrome::VersionInfo::CHANNEL_BETA; |
| + else if (forced_channel == "dev") |
| + channel = chrome::VersionInfo::CHANNEL_DEV; |
| + else if (forced_channel == "canary") |
| + channel = chrome::VersionInfo::CHANNEL_CANARY; |
| + else |
| + NOTREACHED(); |
|
Alexei Svitkine (slow)
2013/01/04 19:56:34
NOTREACHED() should be used for cases that shouldn
SteveT
2013/01/04 20:09:47
Yeah you're right. I've DVLOGged instead, which I
|
| + } |
| + return channel; |
| +} |
| + |
| +// static |
| bool VariationsService::ShouldAddStudy( |
| const Study& study, |
| const chrome::VersionInfo& version_info, |
| const base::Time& reference_date) { |
| if (study.has_filter()) { |
| - if (!CheckStudyChannel(study.filter(), chrome::VersionInfo::GetChannel())) { |
| + if (!CheckStudyChannel(study.filter(), GetChannelForVariations())) { |
| DVLOG(1) << "Filtered out study " << study.name() << " due to channel."; |
| return false; |
| } |