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

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

Issue 12891006: bookmarks: Remove Profile getter accessor from BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cocoa alignments Created 7 years, 8 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 AddAll(node->GetChild(i)); 184 AddAll(node->GetChild(i));
185 } 185 }
186 186
187 const BookmarkNode* BookmarkNodeIdIndex::Find(int64 id) const { 187 const BookmarkNode* BookmarkNodeIdIndex::Find(int64 id) const {
188 BookmarkIdMap::const_iterator iter = node_index_.find(id); 188 BookmarkIdMap::const_iterator iter = node_index_.find(id);
189 return iter == node_index_.end() ? NULL : iter->second; 189 return iter == node_index_.end() ? NULL : iter->second;
190 } 190 }
191 191
192 BookmarkModelAssociator::BookmarkModelAssociator( 192 BookmarkModelAssociator::BookmarkModelAssociator(
193 BookmarkModel* bookmark_model, 193 BookmarkModel* bookmark_model,
194 Profile* profile,
194 syncer::UserShare* user_share, 195 syncer::UserShare* user_share,
195 DataTypeErrorHandler* unrecoverable_error_handler, 196 DataTypeErrorHandler* unrecoverable_error_handler,
196 bool expect_mobile_bookmarks_folder) 197 bool expect_mobile_bookmarks_folder)
197 : bookmark_model_(bookmark_model), 198 : bookmark_model_(bookmark_model),
199 profile_(profile),
198 user_share_(user_share), 200 user_share_(user_share),
199 unrecoverable_error_handler_(unrecoverable_error_handler), 201 unrecoverable_error_handler_(unrecoverable_error_handler),
200 expect_mobile_bookmarks_folder_(expect_mobile_bookmarks_folder), 202 expect_mobile_bookmarks_folder_(expect_mobile_bookmarks_folder),
201 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 203 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 204 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
203 DCHECK(bookmark_model_); 205 DCHECK(bookmark_model_);
204 DCHECK(user_share_); 206 DCHECK(user_share_);
205 DCHECK(unrecoverable_error_handler_); 207 DCHECK(unrecoverable_error_handler_);
206 } 208 }
207 209
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 if (child_node) 496 if (child_node)
495 Associate(child_node, sync_child_id); 497 Associate(child_node, sync_child_id);
496 // All bookmarks are currently modified at association time (even if 498 // All bookmarks are currently modified at association time (even if
497 // it doesn't change anything). 499 // it doesn't change anything).
498 // TODO(sync): introduce logic to only modify the bookmark model if 500 // TODO(sync): introduce logic to only modify the bookmark model if
499 // necessary. 501 // necessary.
500 const BookmarkNode* new_child_node = 502 const BookmarkNode* new_child_node =
501 BookmarkChangeProcessor::CreateOrUpdateBookmarkNode( 503 BookmarkChangeProcessor::CreateOrUpdateBookmarkNode(
502 &sync_child_node, 504 &sync_child_node,
503 bookmark_model_, 505 bookmark_model_,
506 profile_,
504 this); 507 this);
505 if (new_child_node != child_node) { 508 if (new_child_node != child_node) {
506 local_merge_result->set_num_items_added( 509 local_merge_result->set_num_items_added(
507 local_merge_result->num_items_added() + 1); 510 local_merge_result->num_items_added() + 1);
508 } else { 511 } else {
509 local_merge_result->set_num_items_modified( 512 local_merge_result->set_num_items_modified(
510 local_merge_result->num_items_modified() + 1); 513 local_merge_result->num_items_modified() + 1);
511 } 514 }
512 if (sync_child_node.GetIsFolder()) 515 if (sync_child_node.GetIsFolder())
513 dfs_stack.push(sync_child_id); 516 dfs_stack.push(sync_child_id);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 ModelTypeToHistogramInt(syncer::BOOKMARKS), 712 ModelTypeToHistogramInt(syncer::BOOKMARKS),
710 syncer::MODEL_TYPE_COUNT); 713 syncer::MODEL_TYPE_COUNT);
711 // Clear version on bookmark model so that we only report error once. 714 // Clear version on bookmark model so that we only report error once.
712 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(), 715 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(),
713 kBookmarkTransactionVersionKey); 716 kBookmarkTransactionVersionKey);
714 } 717 }
715 } 718 }
716 } 719 }
717 720
718 } // namespace browser_sync 721 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.h ('k') | chrome/browser/sync/profile_sync_components_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698