experiments.h revision effb81e5f8246d0db0270817048dc992db66e9fb
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(false) {}
33
34  bool Matches(const Experiments& rhs) {
35    return (favicon_sync_limit == rhs.favicon_sync_limit &&
36            gcm_channel_state == rhs.gcm_channel_state &&
37            enhanced_bookmarks_enabled == rhs.enhanced_bookmarks_enabled &&
38            enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id &&
39            gcm_invalidations_enabled == rhs.gcm_invalidations_enabled);
40  }
41
42  // The number of favicons that a client is permitted to sync.
43  int favicon_sync_limit;
44
45  // Enable state of the GCM channel.
46  GCMChannelState gcm_channel_state;
47
48  // Enable the enhanced bookmarks sync datatype.
49  bool enhanced_bookmarks_enabled;
50
51  // Enable invalidations over GCM channel.
52  bool gcm_invalidations_enabled;
53
54  // Enhanced bookmarks extension id.
55  std::string enhanced_bookmarks_ext_id;
56};
57
58}  // namespace syncer
59
60#endif  // SYNC_UTIL_EXPERIMENTS_
61