Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/sync/glue/autofill_model_associator.cc

Issue 8396022: [Sync] Add HasChildren() function and use it instead of GetFirstChildId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/glue/autofill_model_associator.h" 5 #include "chrome/browser/sync/glue/autofill_model_associator.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 sync_api::ReadNode autofill_node(&trans); 381 sync_api::ReadNode autofill_node(&trans);
382 if (!autofill_node.InitByIdLookup(autofill_sync_id)) { 382 if (!autofill_node.InitByIdLookup(autofill_sync_id)) {
383 LOG(ERROR) << "Server did not create the top-level autofill node. We " 383 LOG(ERROR) << "Server did not create the top-level autofill node. We "
384 << "might be running against an out-of-date server."; 384 << "might be running against an out-of-date server.";
385 return false; 385 return false;
386 } 386 }
387 387
388 // The sync model has user created nodes if the autofill folder has any 388 // The sync model has user created nodes if the autofill folder has any
389 // children. 389 // children.
390 *has_nodes = sync_api::kInvalidId != autofill_node.GetFirstChildId(); 390 *has_nodes = autofill_node.HasChildren();
391 return true; 391 return true;
392 } 392 }
393 393
394 void AutofillModelAssociator::AbortAssociation() { 394 void AutofillModelAssociator::AbortAssociation() {
395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
396 base::AutoLock lock(abort_association_pending_lock_); 396 base::AutoLock lock(abort_association_pending_lock_);
397 abort_association_pending_ = true; 397 abort_association_pending_ = true;
398 } 398 }
399 399
400 const std::string* 400 const std::string*
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bool AutofillModelAssociator::CryptoReadyIfNecessary() { 520 bool AutofillModelAssociator::CryptoReadyIfNecessary() {
521 // We only access the cryptographer while holding a transaction. 521 // We only access the cryptographer while holding a transaction.
522 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 522 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
523 syncable::ModelTypeSet encrypted_types; 523 syncable::ModelTypeSet encrypted_types;
524 encrypted_types = sync_api::GetEncryptedTypes(&trans); 524 encrypted_types = sync_api::GetEncryptedTypes(&trans);
525 return encrypted_types.count(syncable::AUTOFILL) == 0 || 525 return encrypted_types.count(syncable::AUTOFILL) == 0 ||
526 sync_service_->IsCryptographerReady(&trans); 526 sync_service_->IsCryptographerReady(&trans);
527 } 527 }
528 528
529 } // namespace browser_sync 529 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698