| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/metrics/variations/variations_service.h" | 5 #include "chrome/browser/metrics/variations/variations_service.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // For the HTTP date headers, the resolution of the server time is 1 second. | 60 // For the HTTP date headers, the resolution of the server time is 1 second. |
| 61 const int64 kServerTimeResolutionMs = 1000; | 61 const int64 kServerTimeResolutionMs = 1000; |
| 62 | 62 |
| 63 // Wrapper around channel checking, used to enable channel mocking for | 63 // Wrapper around channel checking, used to enable channel mocking for |
| 64 // testing. If the current browser channel is not UNKNOWN, this will return | 64 // testing. If the current browser channel is not UNKNOWN, this will return |
| 65 // that channel value. Otherwise, if the fake channel flag is provided, this | 65 // that channel value. Otherwise, if the fake channel flag is provided, this |
| 66 // will return the fake channel. Failing that, this will return the UNKNOWN | 66 // will return the fake channel. Failing that, this will return the UNKNOWN |
| 67 // channel. | 67 // channel. |
| 68 variations::Study_Channel GetChannelForVariations() { | 68 variations::Study_Channel GetChannelForVariations() { |
| 69 switch (chrome::VersionInfo::GetChannel()) { | 69 switch (chrome::VersionInfo::GetChannel()) { |
| 70 case chrome::VersionInfo::CHANNEL_CANARY: | 70 case version_info::Channel::CANARY: |
| 71 return variations::Study_Channel_CANARY; | 71 return variations::Study_Channel_CANARY; |
| 72 case chrome::VersionInfo::CHANNEL_DEV: | 72 case version_info::Channel::DEV: |
| 73 return variations::Study_Channel_DEV; | 73 return variations::Study_Channel_DEV; |
| 74 case chrome::VersionInfo::CHANNEL_BETA: | 74 case version_info::Channel::BETA: |
| 75 return variations::Study_Channel_BETA; | 75 return variations::Study_Channel_BETA; |
| 76 case chrome::VersionInfo::CHANNEL_STABLE: | 76 case version_info::Channel::STABLE: |
| 77 return variations::Study_Channel_STABLE; | 77 return variations::Study_Channel_STABLE; |
| 78 case chrome::VersionInfo::CHANNEL_UNKNOWN: | 78 case version_info::Channel::UNKNOWN: |
| 79 break; | 79 break; |
| 80 } | 80 } |
| 81 const std::string forced_channel = | 81 const std::string forced_channel = |
| 82 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 82 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 83 switches::kFakeVariationsChannel); | 83 switches::kFakeVariationsChannel); |
| 84 if (forced_channel == "stable") | 84 if (forced_channel == "stable") |
| 85 return variations::Study_Channel_STABLE; | 85 return variations::Study_Channel_STABLE; |
| 86 if (forced_channel == "beta") | 86 if (forced_channel == "beta") |
| 87 return variations::Study_Channel_BETA; | 87 return variations::Study_Channel_BETA; |
| 88 if (forced_channel == "dev") | 88 if (forced_channel == "dev") |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 // Otherwise, update the pref with the current Chrome version and country. | 719 // Otherwise, update the pref with the current Chrome version and country. |
| 720 base::ListValue new_list_value; | 720 base::ListValue new_list_value; |
| 721 new_list_value.AppendString(version.GetString()); | 721 new_list_value.AppendString(version.GetString()); |
| 722 new_list_value.AppendString(seed.country_code()); | 722 new_list_value.AppendString(seed.country_code()); |
| 723 local_state_->Set(prefs::kVariationsPermanentConsistencyCountry, | 723 local_state_->Set(prefs::kVariationsPermanentConsistencyCountry, |
| 724 new_list_value); | 724 new_list_value); |
| 725 return seed.country_code(); | 725 return seed.country_code(); |
| 726 } | 726 } |
| 727 | 727 |
| 728 } // namespace chrome_variations | 728 } // namespace chrome_variations |
| OLD | NEW |