summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/autofill_model_associator.cc
blob: 43e4db624b1f84809ea8ad1a2b39d5f308cd6ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/sync/glue/autofill_model_associator.h"

#include <functional>
#include <vector>

#include "base/task.h"
#include "base/time.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/autofill_change_processor.h"
#include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
#include "chrome/browser/sync/glue/do_optimistic_refresh_task.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/protocol/autofill_specifics.pb.h"
#include "chrome/browser/webdata/web_database.h"
#include "chrome/common/guid.h"
#include "net/base/escape.h"

using base::TimeTicks;

namespace browser_sync {

const char kAutofillTag[] = "google_chrome_autofill";
const char kAutofillEntryNamespaceTag[] = "autofill_entry|";

struct AutofillModelAssociator::DataBundle {
  std::set<AutofillKey> current_entries;
  std::vector<AutofillEntry> new_entries;
  std::set<string16> current_profiles;
  std::vector<AutoFillProfile*> updated_profiles;
  std::vector<AutoFillProfile*> new_profiles;  // We own these pointers.
  ~DataBundle() { STLDeleteElements(&new_profiles); }
};

AutofillModelAssociator::AutofillModelAssociator(
    ProfileSyncService* sync_service,
    WebDatabase* web_database,
    PersonalDataManager* personal_data)
    : sync_service_(sync_service),
      web_database_(web_database),
      personal_data_(personal_data),
      autofill_node_id_(sync_api::kInvalidId),
      abort_association_pending_(false),
      number_of_entries_created_(0) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
  DCHECK(sync_service_);
  DCHECK(web_database_);
  DCHECK(personal_data_);
}

AutofillModelAssociator::~AutofillModelAssociator() {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
}

bool AutofillModelAssociator::TraverseAndAssociateChromeAutofillEntries(
    sync_api::WriteTransaction* write_trans,
    const sync_api::ReadNode& autofill_root,
    const std::vector<AutofillEntry>& all_entries_from_db,
    std::set<AutofillKey>* current_entries,
    std::vector<AutofillEntry>* new_entries) {

  const std::vector<AutofillEntry>& entries = all_entries_from_db;
  for (std::vector<AutofillEntry>::const_iterator ix = entries.begin();
       ix != entries.end(); ++ix) {
    std::string tag = KeyToTag(ix->key().name(), ix->key().value());
    if (id_map_.find(tag) != id_map_.end()) {
      // It seems that name/value pairs are not unique in the web database.
      // As a result, we have to filter out duplicates here.  This is probably
      // a bug in the database.
      continue;
    }

    sync_api::ReadNode node(write_trans);
    if (node.InitByClientTagLookup(syncable::AUTOFILL, tag)) {
      const sync_pb::AutofillSpecifics& autofill(node.GetAutofillSpecifics());
      DCHECK_EQ(tag, KeyToTag(UTF8ToUTF16(autofill.name()),
                              UTF8ToUTF16(autofill.value())));

      std::vector<base::Time> timestamps;
      if (MergeTimestamps(autofill, ix->timestamps(), &timestamps)) {
        AutofillEntry new_entry(ix->key(), timestamps);
        new_entries->push_back(new_entry);

        sync_api::WriteNode write_node(write_trans);
        if (!write_node.InitByClientTagLookup(syncable::AUTOFILL, tag)) {
          LOG(ERROR) << "Failed to write autofill sync node.";
          return false;
        }
        AutofillChangeProcessor::WriteAutofillEntry(new_entry, &write_node);
      }

      Associate(&tag, node.GetId());
    } else {
      sync_api::WriteNode node(write_trans);
      if (!node.InitUniqueByCreation(syncable::AUTOFILL,
                                     autofill_root, tag)) {
        LOG(ERROR) << "Failed to create autofill sync node.";
        return false;
      }
      node.SetTitle(UTF8ToWide(tag));
      AutofillChangeProcessor::WriteAutofillEntry(*ix, &node);
      Associate(&tag, node.GetId());
      number_of_entries_created_++;
    }

    current_entries->insert(ix->key());
  }
  return true;
}

bool AutofillModelAssociator::LoadAutofillData(
    std::vector<AutofillEntry>* entries,
    std::vector<AutoFillProfile*>* profiles) {
  if (IsAbortPending())
    return false;
  if (!web_database_->GetAllAutofillEntries(entries))
    return false;

  if (IsAbortPending())
    return false;
  if (!web_database_->GetAutoFillProfiles(profiles))
    return false;

  return true;
}

bool AutofillModelAssociator::AssociateModels() {
  VLOG(1) << "Associating Autofill Models";
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
  {
    AutoLock lock(abort_association_pending_lock_);
    abort_association_pending_ = false;
  }

  // TODO(zork): Attempt to load the model association from storage.
  std::vector<AutofillEntry> entries;
  ScopedVector<AutoFillProfile> profiles;

  if (!LoadAutofillData(&entries, &profiles.get())) {
    LOG(ERROR) << "Could not get the autofill data from WebDatabase.";
    return false;
  }

  DataBundle bundle;
  {
    sync_api::WriteTransaction trans(
        sync_service_->backend()->GetUserShareHandle());

    sync_api::ReadNode autofill_root(&trans);
    if (!autofill_root.InitByTagLookup(kAutofillTag)) {
      LOG(ERROR) << "Server did not create the top-level autofill node. We "
                 << "might be running against an out-of-date server.";
      return false;
    }

    if (!TraverseAndAssociateChromeAutofillEntries(&trans, autofill_root,
        entries, &bundle.current_entries, &bundle.new_entries)) {
      return false;
    }

    if (!TraverseAndAssociateAllSyncNodes(
        &trans,
        autofill_root,
        &bundle,
        profiles.get())) {
      return false;
    }
  }

  // Since we're on the DB thread, we don't have to worry about updating
  // the autofill database after closing the write transaction, since
  // this is the only thread that writes to the database.  We also don't have
  // to worry about the sync model getting out of sync, because changes are
  // propogated to the ChangeProcessor on this thread.
  if (!SaveChangesToWebData(bundle)) {
    LOG(ERROR) << "Failed to update autofill entries.";
    return false;
  }

  if (sync_service_->backend()->GetAutofillMigrationState() !=
      syncable::MIGRATED) {
    syncable::AutofillMigrationDebugInfo debug_info;
    debug_info.autofill_entries_added_during_migration =
        number_of_entries_created_;
    sync_service_->backend()->SetAutofillMigrationDebugInfo(
        syncable::AutofillMigrationDebugInfo::ENTRIES_ADDED,
        debug_info);
  }

  BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
      new DoOptimisticRefreshForAutofill(personal_data_));
  return true;
}

bool AutofillModelAssociator::SaveChangesToWebData(const DataBundle& bundle) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));

  if (IsAbortPending())
    return false;

  if (bundle.new_entries.size() &&
      !web_database_->UpdateAutofillEntries(bundle.new_entries)) {
    return false;
  }

  for (size_t i = 0; i < bundle.new_profiles.size(); i++) {
    if (IsAbortPending())
      return false;
    if (!web_database_->AddAutoFillProfile(*bundle.new_profiles[i]))
      return false;
  }

  for (size_t i = 0; i < bundle.updated_profiles.size(); i++) {
    if (IsAbortPending())
      return false;
    if (!web_database_->UpdateAutoFillProfile(*bundle.updated_profiles[i]))
      return false;
  }
  return true;
}

bool AutofillModelAssociator::TraverseAndAssociateAllSyncNodes(
    sync_api::WriteTransaction* write_trans,
    const sync_api::ReadNode& autofill_root,
    DataBundle* bundle,
    const std::vector<AutoFillProfile*>& all_profiles_from_db) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));

  bool autofill_profile_not_migrated = HasNotMigratedYet(write_trans);

  if (VLOG_IS_ON(1) && autofill_profile_not_migrated) {
    VLOG(1) << "[AUTOFILL MIGRATION]"
            << "Printing profiles from web db";

    for (std::vector<AutoFillProfile*>::const_iterator ix =
        all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) {
      AutoFillProfile* p = *ix;
      VLOG(1) << "[AUTOFILL MIGRATION]  "
              << p->GetFieldText(AutoFillType(NAME_FIRST))
              << p->GetFieldText(AutoFillType(NAME_LAST));
    }
  }

  if (autofill_profile_not_migrated) {
    VLOG(1) << "[AUTOFILL MIGRATION]"
            << "Iterating over sync db";
  }

  int64 sync_child_id = autofill_root.GetFirstChildId();
  while (sync_child_id != sync_api::kInvalidId) {
    sync_api::ReadNode sync_child(write_trans);
    if (!sync_child.InitByIdLookup(sync_child_id)) {
      LOG(ERROR) << "Failed to fetch child node.";
      return false;
    }
    const sync_pb::AutofillSpecifics& autofill(
        sync_child.GetAutofillSpecifics());

    if (autofill.has_value()) {
      AddNativeEntryIfNeeded(autofill, bundle, sync_child);
    } else if (autofill.has_profile()) {
      // Ignore autofill profiles if we are not upgrading.
      if (autofill_profile_not_migrated) {
        VLOG(1) << "[AUTOFILL MIGRATION] Looking for "
                << autofill.profile().name_first()
                << autofill.profile().name_last();
        AddNativeProfileIfNeeded(
            autofill.profile(),
            bundle,
            sync_child,
            all_profiles_from_db);
      }
    } else {
      NOTREACHED() << "AutofillSpecifics has no autofill data!";
    }

    sync_child_id = sync_child.GetSuccessorId();
  }
  return true;
}

// Define the functor to be used as the predicate in find_if call.
struct CompareProfiles
  : public std::binary_function<AutoFillProfile*, AutoFillProfile*, bool> {
  bool operator() (AutoFillProfile* p1, AutoFillProfile* p2) const {
    if (p1->Compare(*p2) == 0)
      return true;
    else
      return false;
  }
};

AutoFillProfile* AutofillModelAssociator::FindCorrespondingNodeFromWebDB(
    const sync_pb::AutofillProfileSpecifics& profile,
    const std::vector<AutoFillProfile*>& all_profiles_from_db) {
  static std::string guid(guid::GenerateGUID());
  AutoFillProfile p;
  p.set_guid(guid);
  if (!FillProfileWithServerData(&p, profile)) {
    // Not a big deal. We encountered an error. Just say this profile does not
    // exist.
    LOG(ERROR) << " Profile could not be associated";
    return NULL;
  }

  // Now instantiate the functor and call find_if.
  std::vector<AutoFillProfile*>::const_iterator ix =
      std::find_if(all_profiles_from_db.begin(),
                   all_profiles_from_db.end(),
                   std::bind2nd(CompareProfiles(), &p));

  return (ix == all_profiles_from_db.end()) ? NULL : *ix;
}

void AutofillModelAssociator::AddNativeEntryIfNeeded(
    const sync_pb::AutofillSpecifics& autofill, DataBundle* bundle,
    const sync_api::ReadNode& node) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
  AutofillKey key(UTF8ToUTF16(autofill.name()), UTF8ToUTF16(autofill.value()));

  if (bundle->current_entries.find(key) == bundle->current_entries.end()) {
    std::vector<base::Time> timestamps;
    int timestamps_count = autofill.usage_timestamp_size();
    for (int c = 0; c < timestamps_count; ++c) {
      timestamps.push_back(base::Time::FromInternalValue(
          autofill.usage_timestamp(c)));
    }
    std::string tag(KeyToTag(key.name(), key.value()));
    Associate(&tag, node.GetId());
    bundle->new_entries.push_back(AutofillEntry(key, timestamps));
  }
}

void AutofillModelAssociator::AddNativeProfileIfNeeded(
    const sync_pb::AutofillProfileSpecifics& profile,
    DataBundle* bundle,
    const sync_api::ReadNode& node,
    const std::vector<AutoFillProfile*>& all_profiles_from_db) {

  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));

  AutoFillProfile* profile_in_web_db = FindCorrespondingNodeFromWebDB(
      profile, all_profiles_from_db);

  if (profile_in_web_db != NULL) {
    VLOG(1) << "[AUTOFILL MIGRATION]"
            << "Node found in web db. So associating";
    int64 sync_id = node.GetId();
    std::string guid = profile_in_web_db->guid();
    Associate(&guid, sync_id);
    return;
  } else {  // Create a new node.
    VLOG(1) << "[AUTOFILL MIGRATION]"
            << "Node not found in web db so creating and associating";
    std::string guid = guid::GenerateGUID();
    Associate(&guid, node.GetId());
    AutoFillProfile* p = new AutoFillProfile(guid);
    FillProfileWithServerData(p, profile);
    bundle->new_profiles.push_back(p);
  }
}

bool AutofillModelAssociator::DisassociateModels() {
  id_map_.clear();
  id_map_inverse_.clear();
  return true;
}

bool AutofillModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) {
  DCHECK(has_nodes);
  *has_nodes = false;
  int64 autofill_sync_id;
  if (!GetSyncIdForTaggedNode(kAutofillTag, &autofill_sync_id)) {
    LOG(ERROR) << "Server did not create the top-level autofill node. We "
               << "might be running against an out-of-date server.";
    return false;
  }
  sync_api::ReadTransaction trans(
      sync_service_->backend()->GetUserShareHandle());

  sync_api::ReadNode autofill_node(&trans);
  if (!autofill_node.InitByIdLookup(autofill_sync_id)) {
    LOG(ERROR) << "Server did not create the top-level autofill node. We "
               << "might be running against an out-of-date server.";
    return false;
  }

  // The sync model has user created nodes if the autofill folder has any
  // children.
  *has_nodes = sync_api::kInvalidId != autofill_node.GetFirstChildId();
  return true;
}

void AutofillModelAssociator::AbortAssociation() {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  AutoLock lock(abort_association_pending_lock_);
  abort_association_pending_ = true;
}

const std::string*
AutofillModelAssociator::GetChromeNodeFromSyncId(int64 sync_id) {
  SyncIdToAutofillMap::const_iterator iter = id_map_inverse_.find(sync_id);
  return iter == id_map_inverse_.end() ? NULL : &(iter->second);
}

bool AutofillModelAssociator::InitSyncNodeFromChromeId(
    const std::string& node_id,
    sync_api::BaseNode* sync_node) {
  return false;
}

int64 AutofillModelAssociator::GetSyncIdFromChromeId(
    const std::string& autofill) {
  AutofillToSyncIdMap::const_iterator iter = id_map_.find(autofill);
  return iter == id_map_.end() ? sync_api::kInvalidId : iter->second;
}

void AutofillModelAssociator::Associate(
    const std::string* autofill, int64 sync_id) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
  DCHECK_NE(sync_api::kInvalidId, sync_id);
  DCHECK(id_map_.find(*autofill) == id_map_.end());
  DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end());
  id_map_[*autofill] = sync_id;
  id_map_inverse_[sync_id] = *autofill;
}

void AutofillModelAssociator::Disassociate(int64 sync_id) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
  SyncIdToAutofillMap::iterator iter = id_map_inverse_.find(sync_id);
  if (iter == id_map_inverse_.end())
    return;
  CHECK(id_map_.erase(iter->second));
  id_map_inverse_.erase(iter);
}

bool AutofillModelAssociator::GetSyncIdForTaggedNode(const std::string& tag,
                                                     int64* sync_id) {
  sync_api::ReadTransaction trans(
      sync_service_->backend()->GetUserShareHandle());
  sync_api::ReadNode sync_node(&trans);
  if (!sync_node.InitByTagLookup(tag.c_str()))
    return false;
  *sync_id = sync_node.GetId();
  return true;
}

bool AutofillModelAssociator::IsAbortPending() {
  AutoLock lock(abort_association_pending_lock_);
  return abort_association_pending_;
}

// static
std::string AutofillModelAssociator::KeyToTag(const string16& name,
                                              const string16& value) {
  std::string ns(kAutofillEntryNamespaceTag);
  return ns + EscapePath(UTF16ToUTF8(name)) + "|" +
         EscapePath(UTF16ToUTF8(value));
}

// static
bool AutofillModelAssociator::MergeTimestamps(
    const sync_pb::AutofillSpecifics& autofill,
    const std::vector<base::Time>& timestamps,
    std::vector<base::Time>* new_timestamps) {
  DCHECK(new_timestamps);
  std::set<base::Time> timestamp_union(timestamps.begin(),
                                       timestamps.end());

  size_t timestamps_count = autofill.usage_timestamp_size();

  bool different = timestamps.size() != timestamps_count;
  for (size_t c = 0; c < timestamps_count; ++c) {
    if (timestamp_union.insert(base::Time::FromInternalValue(
            autofill.usage_timestamp(c))).second) {
      different = true;
    }
  }

  if (different) {
    new_timestamps->insert(new_timestamps->begin(),
                           timestamp_union.begin(),
                           timestamp_union.end());
  }
  return different;
}

// Helper to compare the local value and cloud value of a field, merge into
// the local value if they differ, and return whether the merge happened.
bool MergeField(FormGroup* f, AutoFillFieldType t,
                const std::string& specifics_field) {
  if (UTF16ToUTF8(f->GetFieldText(AutoFillType(t))) == specifics_field)
    return false;
  f->SetInfo(AutoFillType(t), UTF8ToUTF16(specifics_field));
  return true;
}

// static
bool AutofillModelAssociator::FillProfileWithServerData(
    AutoFillProfile* merge_into,
    const sync_pb::AutofillProfileSpecifics& specifics) {
  bool diff = false;
  AutoFillProfile* p = merge_into;
  const sync_pb::AutofillProfileSpecifics& s(specifics);
  diff = MergeField(p, NAME_FIRST, s.name_first()) || diff;
  diff = MergeField(p, NAME_LAST, s.name_last()) || diff;
  diff = MergeField(p, NAME_MIDDLE, s.name_middle()) || diff;
  diff = MergeField(p, ADDRESS_HOME_LINE1, s.address_home_line1()) || diff;
  diff = MergeField(p, ADDRESS_HOME_LINE2, s.address_home_line2()) || diff;
  diff = MergeField(p, ADDRESS_HOME_CITY, s.address_home_city()) || diff;
  diff = MergeField(p, ADDRESS_HOME_STATE, s.address_home_state()) || diff;
  diff = MergeField(p, ADDRESS_HOME_COUNTRY, s.address_home_country()) || diff;
  diff = MergeField(p, ADDRESS_HOME_ZIP, s.address_home_zip()) || diff;
  diff = MergeField(p, EMAIL_ADDRESS, s.email_address()) || diff;
  diff = MergeField(p, COMPANY_NAME, s.company_name()) || diff;
  diff = MergeField(p, PHONE_FAX_WHOLE_NUMBER, s.phone_fax_whole_number())
      || diff;
  diff = MergeField(p, PHONE_HOME_WHOLE_NUMBER, s.phone_home_whole_number())
      || diff;
  return diff;
}

bool AutofillModelAssociator::HasNotMigratedYet(
    const sync_api::BaseTransaction* trans) {

  // Now read the current value from the directory.
  syncable::AutofillMigrationState autofill_migration_state =
      sync_service()->backend()->GetAutofillMigrationState();

  DCHECK_NE(autofill_migration_state, syncable::NOT_DETERMINED);

  if (autofill_migration_state== syncable::NOT_DETERMINED) {
    VLOG(1) << "Autofill migration state is not determined inside "
            << " model associator";
  }

  if (autofill_migration_state == syncable::NOT_MIGRATED) {
    return true;
  }

  if (autofill_migration_state == syncable::INSUFFICIENT_INFO_TO_DETERMINE) {
      VLOG(1) << "[AUTOFILL MIGRATION]"
              << "current autofill migration state is insufficient info to"
              << "determine.";
      sync_api::ReadNode autofill_profile_root_node(trans);
      if (!autofill_profile_root_node.InitByTagLookup(
          browser_sync::kAutofillProfileTag) ||
          autofill_profile_root_node.GetFirstChildId()==
            static_cast<int64>(0)) {
        sync_service()->backend()->SetAutofillMigrationState(
            syncable::NOT_MIGRATED);

        VLOG(1) << "[AUTOFILL MIGRATION]"
                << "Current autofill migration state is NOT Migrated because"
                << "legacy autofill root node is present whereas new "
                << "Autofill profile root node is absent.";
        return true;
      }

      sync_service()->backend()->SetAutofillMigrationState(syncable::MIGRATED);

      VLOG(1) << "[AUTOFILL MIGRATION]"
              << "Current autofill migration state is migrated.";
  }

  return false;
}

}  // namespace browser_sync