| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/gcm_driver/gcm_channel_status_syncer.h" | 5 #include "components/gcm_driver/gcm_channel_status_syncer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 registry->RegisterBooleanPref(prefs::kGCMChannelStatus, true); | 61 registry->RegisterBooleanPref(prefs::kGCMChannelStatus, true); |
| 62 registry->RegisterIntegerPref( | 62 registry->RegisterIntegerPref( |
| 63 prefs::kGCMChannelPollIntervalSeconds, | 63 prefs::kGCMChannelPollIntervalSeconds, |
| 64 GCMChannelStatusRequest::default_poll_interval_seconds()); | 64 GCMChannelStatusRequest::default_poll_interval_seconds()); |
| 65 registry->RegisterInt64Pref(prefs::kGCMChannelLastCheckTime, 0); | 65 registry->RegisterInt64Pref(prefs::kGCMChannelLastCheckTime, 0); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // static | 68 // static |
| 69 void GCMChannelStatusSyncer::RegisterProfilePrefs( | 69 void GCMChannelStatusSyncer::RegisterProfilePrefs( |
| 70 user_prefs::PrefRegistrySyncable* registry) { | 70 user_prefs::PrefRegistrySyncable* registry) { |
| 71 registry->RegisterBooleanPref( | 71 registry->RegisterBooleanPref(prefs::kGCMChannelStatus, true); |
| 72 prefs::kGCMChannelStatus, | |
| 73 true, | |
| 74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 75 registry->RegisterIntegerPref( | 72 registry->RegisterIntegerPref( |
| 76 prefs::kGCMChannelPollIntervalSeconds, | 73 prefs::kGCMChannelPollIntervalSeconds, |
| 77 GCMChannelStatusRequest::default_poll_interval_seconds(), | 74 GCMChannelStatusRequest::default_poll_interval_seconds()); |
| 78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 75 registry->RegisterInt64Pref(prefs::kGCMChannelLastCheckTime, 0); |
| 79 registry->RegisterInt64Pref( | |
| 80 prefs::kGCMChannelLastCheckTime, | |
| 81 0, | |
| 82 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 83 } | 76 } |
| 84 | 77 |
| 85 // static | 78 // static |
| 86 int GCMChannelStatusSyncer::first_time_delay_seconds() { | 79 int GCMChannelStatusSyncer::first_time_delay_seconds() { |
| 87 return kFirstTimeDelaySeconds; | 80 return kFirstTimeDelaySeconds; |
| 88 } | 81 } |
| 89 | 82 |
| 90 GCMChannelStatusSyncer::GCMChannelStatusSyncer( | 83 GCMChannelStatusSyncer::GCMChannelStatusSyncer( |
| 91 GCMDriver* driver, | 84 GCMDriver* driver, |
| 92 PrefService* prefs, | 85 PrefService* prefs, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Otherwise, add a fuzzing variation to the delay. | 225 // Otherwise, add a fuzzing variation to the delay. |
| 233 // The fuzzing variation is off when the custom interval is used. | 226 // The fuzzing variation is off when the custom interval is used. |
| 234 if (!custom_poll_interval_use_count_) | 227 if (!custom_poll_interval_use_count_) |
| 235 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds); | 228 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds); |
| 236 } | 229 } |
| 237 | 230 |
| 238 return base::TimeDelta::FromSeconds(delay_seconds); | 231 return base::TimeDelta::FromSeconds(delay_seconds); |
| 239 } | 232 } |
| 240 | 233 |
| 241 } // namespace gcm | 234 } // namespace gcm |
| OLD | NEW |