1ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved.
221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen// Use of this source code is governed by a BSD-style license that can be
321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen// found in the LICENSE file.
421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#ifndef CHROME_BROWSER_SYNC_SYNCABLE_AUTOFILL_MIGRATION_H_
621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#define CHROME_BROWSER_SYNC_SYNCABLE_AUTOFILL_MIGRATION_H_
721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#pragma once
821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsennamespace syncable {
1021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenenum AutofillMigrationState {
1121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
1221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // Indicates the default state. After first run the state would change to
1321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // one of the following.
1421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  NOT_DETERMINED,
1521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
1621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // The autofill profile is not migrated. Current sync should migrate the data
1721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // by syncing down the old autofill and syncing profiles back up to the server
1821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // as new autofill.
1921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  NOT_MIGRATED,
2021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
2121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // We have migrated the autofill profile data. From now on autofill and
2221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // autofill profiles are 2 seperate data types.
2321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  MIGRATED,
2421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
2521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // The autofill datatype is being synced new.(either because this is a new
2621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // client or the user just enabled them for syncing). In which case if
2721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // someother client had migrated the data already then our new state after
2821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // first sync would be MIGRATED. Else we would be responsible for migrating
2921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  // the data.
3021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  INSUFFICIENT_INFO_TO_DETERMINE
3121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen};
3221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
3321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenstruct AutofillMigrationDebugInfo {
3421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  enum PropertyToSet {
3521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen    MIGRATION_TIME,
3621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen    ENTRIES_ADDED,
3721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen    PROFILES_ADDED
3821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  };
3921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  int64 autofill_migration_time;
40ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen  // NOTE(akalin): We don't increment
41ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen  // |bookmarks_added_during_migration| anymore, although it's not
42ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen  // worth the effort to remove it from the code.  Eventually, this
43ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen  // will go away once we remove all the autofill migration code.
4421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  int bookmarks_added_during_migration;
4521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  int autofill_entries_added_during_migration;
4621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen  int autofill_profile_added_during_migration;
4721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen};
4821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
4921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen}  // namespace syncable
5021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
5121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#endif  // CHROME_BROWSER_SYNC_SYNCABLE_AUTOFILL_MIGRATION_H_
5221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen
53