| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef WebSyncRegistration_h | 5 #ifndef WebSyncRegistration_h |
| 6 #define WebSyncRegistration_h | 6 #define WebSyncRegistration_h |
| 7 | 7 |
| 8 #include "public/platform/WebPrivatePtr.h" | 8 #include "public/platform/WebPrivatePtr.h" |
| 9 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 struct WebSyncRegistration { | 13 struct WebSyncRegistration { |
| 14 enum NetworkState { | 14 enum NetworkState { |
| 15 NetworkStateAny = 0, | 15 NetworkStateAny = 0, |
| 16 NetworkStateAvoidCellular, | 16 NetworkStateAvoidCellular, |
| 17 NetworkStateOnline, | 17 NetworkStateOnline, |
| 18 NetworkStateLast = NetworkStateOnline | 18 NetworkStateLast = NetworkStateOnline |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 enum { UNREGISTERED_SYNC_ID = -1}; | 21 enum { UNREGISTERED_SYNC_ID = -1}; |
| 22 | 22 |
| 23 enum Periodicity { | |
| 24 PeriodicityPeriodic = 0, | |
| 25 PeriodicityOneShot, | |
| 26 PeriodicityLast = PeriodicityOneShot | |
| 27 }; | |
| 28 | |
| 29 WebSyncRegistration() | 23 WebSyncRegistration() |
| 30 : id(UNREGISTERED_SYNC_ID) | 24 : id(UNREGISTERED_SYNC_ID) |
| 31 , periodicity(PeriodicityOneShot) | |
| 32 , tag("") | 25 , tag("") |
| 33 , minPeriodMs(0) | |
| 34 , networkState(NetworkState::NetworkStateOnline) | 26 , networkState(NetworkState::NetworkStateOnline) |
| 35 { | 27 { |
| 36 } | 28 } |
| 37 | 29 |
| 38 WebSyncRegistration(int64_t id, Periodicity periodicity, | 30 WebSyncRegistration(int64_t id, |
| 39 const WebString& registrationTag, unsigned long minPeriodMs, | 31 const WebString& registrationTag, |
| 40 NetworkState networkState) | 32 NetworkState networkState) |
| 41 : id(id) | 33 : id(id) |
| 42 , periodicity(periodicity) | |
| 43 , tag(registrationTag) | 34 , tag(registrationTag) |
| 44 , minPeriodMs(minPeriodMs) | |
| 45 , networkState(networkState) | 35 , networkState(networkState) |
| 46 { | 36 { |
| 47 } | 37 } |
| 48 | 38 |
| 49 /* Internal identity; not exposed to JS API. */ | 39 /* Internal identity; not exposed to JS API. */ |
| 50 int64_t id; | 40 int64_t id; |
| 51 | 41 |
| 52 /* Internal flag; not directly exposed to JS API. | |
| 53 * Instead, this determines whether this object is represented in JS as a | |
| 54 * SyncRegistration or a PeriodicSyncRegistration. | |
| 55 */ | |
| 56 Periodicity periodicity; | |
| 57 | |
| 58 WebString tag; | 42 WebString tag; |
| 59 | |
| 60 /* Minimum time between periodic sync events, in milliseconds. A 0 value | |
| 61 * here means that the event is a one-shot (not periodic.) | |
| 62 */ | |
| 63 unsigned long minPeriodMs; | |
| 64 | |
| 65 NetworkState networkState; | 43 NetworkState networkState; |
| 66 }; | 44 }; |
| 67 | 45 |
| 68 } // namespace blink | 46 } // namespace blink |
| 69 | 47 |
| 70 #endif // WebSyncRegistration_h | 48 #endif // WebSyncRegistration_h |
| OLD | NEW |