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 #ifndef SYNC_UTIL_EXPERIMENTS_ | 5 #ifndef SYNC_UTIL_EXPERIMENTS_ |
6 #define SYNC_UTIL_EXPERIMENTS_ | 6 #define SYNC_UTIL_EXPERIMENTS_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
11 | 11 |
12 namespace syncer { | 12 namespace syncer { |
13 | 13 |
14 const char kFaviconSyncTag[] = "favicon_sync"; | 14 const char kFaviconSyncTag[] = "favicon_sync"; |
15 const char kPreCommitUpdateAvoidanceTag[] = "pre_commit_update_avoidance"; | 15 const char kPreCommitUpdateAvoidanceTag[] = "pre_commit_update_avoidance"; |
16 const char kGCMChannelTag[] = "gcm_channel"; | |
17 const char kEnhancedBookmarksTag[] = "enhanced_bookmarks"; | 16 const char kEnhancedBookmarksTag[] = "enhanced_bookmarks"; |
18 const char kGCMInvalidationsTag[] = "gcm_invalidations"; | 17 const char kGCMInvalidationsTag[] = "gcm_invalidations"; |
19 const char kWalletSyncTag[] = "wallet_sync"; | 18 const char kWalletSyncTag[] = "wallet_sync"; |
20 | 19 |
21 // A structure to hold the enable status of experimental sync features. | 20 // A structure to hold the enable status of experimental sync features. |
22 struct Experiments { | 21 struct Experiments { |
23 enum GCMChannelState { | |
24 UNSET, | |
25 SUPPRESSED, | |
26 ENABLED, | |
27 }; | |
28 | |
29 Experiments() | 22 Experiments() |
30 : favicon_sync_limit(200), | 23 : favicon_sync_limit(200), |
31 gcm_channel_state(UNSET), | |
32 enhanced_bookmarks_enabled(false), | 24 enhanced_bookmarks_enabled(false), |
33 gcm_invalidations_enabled(true), // By default GCM channel is enabled. | 25 gcm_invalidations_enabled(true), // By default GCM channel is enabled. |
34 wallet_sync_enabled(false) {} | 26 wallet_sync_enabled(false) {} |
35 | 27 |
36 bool Matches(const Experiments& rhs) { | 28 bool Matches(const Experiments& rhs) { |
37 return (favicon_sync_limit == rhs.favicon_sync_limit && | 29 return (favicon_sync_limit == rhs.favicon_sync_limit && |
38 gcm_channel_state == rhs.gcm_channel_state && | |
39 enhanced_bookmarks_enabled == rhs.enhanced_bookmarks_enabled && | 30 enhanced_bookmarks_enabled == rhs.enhanced_bookmarks_enabled && |
40 enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id && | 31 enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id && |
41 gcm_invalidations_enabled == rhs.gcm_invalidations_enabled && | 32 gcm_invalidations_enabled == rhs.gcm_invalidations_enabled && |
42 wallet_sync_enabled == rhs.wallet_sync_enabled); | 33 wallet_sync_enabled == rhs.wallet_sync_enabled); |
43 } | 34 } |
44 | 35 |
45 // The number of favicons that a client is permitted to sync. | 36 // The number of favicons that a client is permitted to sync. |
46 int favicon_sync_limit; | 37 int favicon_sync_limit; |
47 | 38 |
48 // Enable state of the GCM channel. | |
49 GCMChannelState gcm_channel_state; | |
50 | |
51 // Enable the enhanced bookmarks sync datatype. | 39 // Enable the enhanced bookmarks sync datatype. |
52 bool enhanced_bookmarks_enabled; | 40 bool enhanced_bookmarks_enabled; |
53 | 41 |
54 // Enable invalidations over GCM channel. | 42 // Enable invalidations over GCM channel. |
55 bool gcm_invalidations_enabled; | 43 bool gcm_invalidations_enabled; |
56 | 44 |
57 // Enhanced bookmarks extension id. | 45 // Enhanced bookmarks extension id. |
58 std::string enhanced_bookmarks_ext_id; | 46 std::string enhanced_bookmarks_ext_id; |
59 | 47 |
60 // Enable the Wallet Autofill sync datatype. | 48 // Enable the Wallet Autofill sync datatype. |
61 bool wallet_sync_enabled; | 49 bool wallet_sync_enabled; |
62 }; | 50 }; |
63 | 51 |
64 } // namespace syncer | 52 } // namespace syncer |
65 | 53 |
66 #endif // SYNC_UTIL_EXPERIMENTS_ | 54 #endif // SYNC_UTIL_EXPERIMENTS_ |
OLD | NEW |