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