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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 syncer::WriteNode::InitUniqueByCreationResult result = | 292 syncer::WriteNode::InitUniqueByCreationResult result = |
293 node.InitUniqueByCreation(syncer::TYPED_URLS, | 293 node.InitUniqueByCreation(syncer::TYPED_URLS, |
294 typed_url_root, tag); | 294 typed_url_root, tag); |
295 if (result != syncer::WriteNode::INIT_SUCCESS) { | 295 if (result != syncer::WriteNode::INIT_SUCCESS) { |
296 return error_handler_->CreateAndUploadError( | 296 return error_handler_->CreateAndUploadError( |
297 FROM_HERE, | 297 FROM_HERE, |
298 "Failed to create typed_url sync node: " + tag, | 298 "Failed to create typed_url sync node: " + tag, |
299 model_type()); | 299 model_type()); |
300 } | 300 } |
301 | 301 |
302 node.SetTitle(UTF8ToWide(tag)); | 302 node.SetTitle(base::UTF8ToWide(tag)); |
303 WriteToSyncNode(*ix, visits, &node); | 303 WriteToSyncNode(*ix, visits, &node); |
304 } | 304 } |
305 | 305 |
306 current_urls.insert(tag); | 306 current_urls.insert(tag); |
307 } | 307 } |
308 | 308 |
309 // Now walk the sync nodes and detect any URLs that exist there, but not in | 309 // Now walk the sync nodes and detect any URLs that exist there, but not in |
310 // the history DB, so we can add them to our local history DB. | 310 // the history DB, so we can add them to our local history DB. |
311 std::vector<int64> obsolete_nodes; | 311 std::vector<int64> obsolete_nodes; |
312 int64 sync_child_id = typed_url_root.GetFirstChildId(); | 312 int64 sync_child_id = typed_url_root.GetFirstChildId(); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 837 |
838 bool TypedUrlModelAssociator::CryptoReadyIfNecessary() { | 838 bool TypedUrlModelAssociator::CryptoReadyIfNecessary() { |
839 // We only access the cryptographer while holding a transaction. | 839 // We only access the cryptographer while holding a transaction. |
840 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 840 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
841 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); | 841 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); |
842 return !encrypted_types.Has(syncer::TYPED_URLS) || | 842 return !encrypted_types.Has(syncer::TYPED_URLS) || |
843 sync_service_->IsCryptographerReady(&trans); | 843 sync_service_->IsCryptographerReady(&trans); |
844 } | 844 } |
845 | 845 |
846 } // namespace browser_sync | 846 } // namespace browser_sync |
OLD | NEW |