OLD | NEW |
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/typed_url_model_associator.h" | 5 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 303 } |
304 if (difference & DIFF_LOCAL_VISITS_ADDED) { | 304 if (difference & DIFF_LOCAL_VISITS_ADDED) { |
305 new_visits.push_back( | 305 new_visits.push_back( |
306 std::pair<GURL, std::vector<history::VisitInfo> >(ix->url(), | 306 std::pair<GURL, std::vector<history::VisitInfo> >(ix->url(), |
307 added_visits)); | 307 added_visits)); |
308 } | 308 } |
309 } else { | 309 } else { |
310 // Sync has never seen this URL before. | 310 // Sync has never seen this URL before. |
311 syncer::WriteNode node(&trans); | 311 syncer::WriteNode node(&trans); |
312 syncer::WriteNode::InitUniqueByCreationResult result = | 312 syncer::WriteNode::InitUniqueByCreationResult result = |
313 node.InitUniqueByCreation(syncer::TYPED_URLS, | 313 node.InitUniqueByCreation(syncer::TYPED_URLS, tag); |
314 typed_url_root, tag); | |
315 if (result != syncer::WriteNode::INIT_SUCCESS) { | 314 if (result != syncer::WriteNode::INIT_SUCCESS) { |
316 return error_handler_->CreateAndUploadError( | 315 return error_handler_->CreateAndUploadError( |
317 FROM_HERE, | 316 FROM_HERE, |
318 "Failed to create typed_url sync node: " + tag, | 317 "Failed to create typed_url sync node: " + tag, |
319 model_type()); | 318 model_type()); |
320 } | 319 } |
321 | 320 |
322 node.SetTitle(tag); | 321 node.SetTitle(tag); |
323 WriteToSyncNode(*ix, visits, &node); | 322 WriteToSyncNode(*ix, visits, &node); |
324 syncer_merge_result->set_num_items_added( | 323 syncer_merge_result->set_num_items_added( |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 852 |
854 bool TypedUrlModelAssociator::CryptoReadyIfNecessary() { | 853 bool TypedUrlModelAssociator::CryptoReadyIfNecessary() { |
855 // We only access the cryptographer while holding a transaction. | 854 // We only access the cryptographer while holding a transaction. |
856 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 855 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
857 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); | 856 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); |
858 return !encrypted_types.Has(syncer::TYPED_URLS) || | 857 return !encrypted_types.Has(syncer::TYPED_URLS) || |
859 sync_service_->IsCryptographerReady(&trans); | 858 sync_service_->IsCryptographerReady(&trans); |
860 } | 859 } |
861 | 860 |
862 } // namespace browser_sync | 861 } // namespace browser_sync |
OLD | NEW |