15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef SYNC_UTIL_EXPERIMENTS_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SYNC_UTIL_EXPERIMENTS_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <string>
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sync/internal_api/public/base/model_type.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace syncer {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)const char kFaviconSyncTag[] = "favicon_sync";
15ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdochconst char kPreCommitUpdateAvoidanceTag[] = "pre_commit_update_avoidance";
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)const char kGCMChannelTag[] = "gcm_channel";
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)const char kEnhancedBookmarksTag[] = "enhanced_bookmarks";
18effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochconst char kGCMInvalidationsTag[] = "gcm_invalidations";
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A structure to hold the enable status of experimental sync features.
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct Experiments {
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  enum GCMChannelState {
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    UNSET,
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SUPPRESSED,
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    ENABLED,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  };
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  Experiments()
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      : favicon_sync_limit(200),
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        gcm_channel_state(UNSET),
31effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch        enhanced_bookmarks_enabled(false),
321675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch        gcm_invalidations_enabled(true)  // By default GCM channel is enabled.
331675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch  {}
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool Matches(const Experiments& rhs) {
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return (favicon_sync_limit == rhs.favicon_sync_limit &&
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)            gcm_channel_state == rhs.gcm_channel_state &&
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)            enhanced_bookmarks_enabled == rhs.enhanced_bookmarks_enabled &&
39effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch            enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id &&
40effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch            gcm_invalidations_enabled == rhs.gcm_invalidations_enabled);
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // The number of favicons that a client is permitted to sync.
44c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  int favicon_sync_limit;
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Enable state of the GCM channel.
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  GCMChannelState gcm_channel_state;
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Enable the enhanced bookmarks sync datatype.
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool enhanced_bookmarks_enabled;
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
52effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Enable invalidations over GCM channel.
53effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  bool gcm_invalidations_enabled;
54effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Enhanced bookmarks extension id.
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  std::string enhanced_bookmarks_ext_id;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace syncer
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // SYNC_UTIL_EXPERIMENTS_
62