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

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

Issue 10828268: [Sync] Fix mobile bookmark folder association on non-android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ifdef Created 8 years, 4 months 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/profile_sync_service_bookmark_unittest.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) 2012 The Chromium Authors. All rights reserved. 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 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/bookmark_model_associator.h" 5 #include "chrome/browser/sync/glue/bookmark_model_associator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // This algorithm will not do well if the folder name has changes but the 390 // This algorithm will not do well if the folder name has changes but the
391 // children under them are all the same. 391 // children under them are all the same.
392 392
393 syncer::SyncError error; 393 syncer::SyncError error;
394 DCHECK(bookmark_model_->IsLoaded()); 394 DCHECK(bookmark_model_->IsLoaded());
395 395
396 // To prime our association, we associate the top-level nodes, Bookmark Bar 396 // To prime our association, we associate the top-level nodes, Bookmark Bar
397 // and Other Bookmarks. 397 // and Other Bookmarks.
398 error = AssociateTaggedPermanentNode(bookmark_model_->other_node(), 398 error = AssociateTaggedPermanentNode(bookmark_model_->other_node(),
399 kOtherBookmarksTag); 399 kOtherBookmarksTag);
400 if (error.IsSet()) { 400 if (error.IsSet())
401 return error; 401 return error;
402 }
403 402
404 error = AssociateTaggedPermanentNode(bookmark_model_->bookmark_bar_node(), 403 error = AssociateTaggedPermanentNode(bookmark_model_->bookmark_bar_node(),
405 kBookmarkBarTag); 404 kBookmarkBarTag);
406 if (error.IsSet()) { 405 if (error.IsSet())
407 return error; 406 return error;
408 }
409 407
410 if (expect_mobile_bookmarks_folder_) { 408 error = AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
411 error = AssociateTaggedPermanentNode(bookmark_model_->mobile_node(), 409 kMobileBookmarksTag);
412 kMobileBookmarksTag); 410 if (error.IsSet() && expect_mobile_bookmarks_folder_)
413 if (error.IsSet()) { 411 return error;
414 return error; 412 else
tim (not reviewing) 2012/08/10 23:31:22 The 'else' isn't really necessary here. Lets just
415 } 413 error = syncer::SyncError();
416 }
417 414
418 int64 bookmark_bar_sync_id = GetSyncIdFromChromeId( 415 int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
419 bookmark_model_->bookmark_bar_node()->id()); 416 bookmark_model_->bookmark_bar_node()->id());
420 DCHECK_NE(bookmark_bar_sync_id, syncer::kInvalidId); 417 DCHECK_NE(bookmark_bar_sync_id, syncer::kInvalidId);
421 int64 other_bookmarks_sync_id = GetSyncIdFromChromeId( 418 int64 other_bookmarks_sync_id = GetSyncIdFromChromeId(
422 bookmark_model_->other_node()->id()); 419 bookmark_model_->other_node()->id());
423 DCHECK_NE(other_bookmarks_sync_id, syncer::kInvalidId); 420 DCHECK_NE(other_bookmarks_sync_id, syncer::kInvalidId);
424 int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId( 421 int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId(
425 bookmark_model_->mobile_node()->id()); 422 bookmark_model_->mobile_node()->id());
426 if (expect_mobile_bookmarks_folder_) { 423 if (expect_mobile_bookmarks_folder_) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 bool BookmarkModelAssociator::CryptoReadyIfNecessary() { 660 bool BookmarkModelAssociator::CryptoReadyIfNecessary() {
664 // We only access the cryptographer while holding a transaction. 661 // We only access the cryptographer while holding a transaction.
665 syncer::ReadTransaction trans(FROM_HERE, user_share_); 662 syncer::ReadTransaction trans(FROM_HERE, user_share_);
666 const syncer::ModelTypeSet encrypted_types = 663 const syncer::ModelTypeSet encrypted_types =
667 syncer::GetEncryptedTypes(&trans); 664 syncer::GetEncryptedTypes(&trans);
668 return !encrypted_types.Has(syncer::BOOKMARKS) || 665 return !encrypted_types.Has(syncer::BOOKMARKS) ||
669 trans.GetCryptographer()->is_ready(); 666 trans.GetCryptographer()->is_ready();
670 } 667 }
671 668
672 } // namespace browser_sync 669 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698