OLD | NEW |
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/internal_api/write_node.h" | 5 #include "chrome/browser/sync/internal_api/write_node.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/sync/engine/nigori_util.h" | 10 #include "chrome/browser/sync/engine/nigori_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace sync_api { | 31 namespace sync_api { |
32 | 32 |
33 static const char kDefaultNameForNewNodes[] = " "; | 33 static const char kDefaultNameForNewNodes[] = " "; |
34 | 34 |
35 bool WriteNode::UpdateEntryWithEncryption( | 35 bool WriteNode::UpdateEntryWithEncryption( |
36 browser_sync::Cryptographer* cryptographer, | 36 browser_sync::Cryptographer* cryptographer, |
37 const sync_pb::EntitySpecifics& new_specifics, | 37 const sync_pb::EntitySpecifics& new_specifics, |
38 syncable::MutableEntry* entry) { | 38 syncable::MutableEntry* entry) { |
39 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(new_specifics); | 39 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(new_specifics); |
40 DCHECK_GE(type, syncable::FIRST_REAL_MODEL_TYPE); | 40 DCHECK_GE(type, syncable::FIRST_REAL_MODEL_TYPE); |
41 const syncable::ModelEnumSet encrypted_types = | 41 const syncable::ModelTypeSet encrypted_types = |
42 cryptographer->GetEncryptedTypes(); | 42 cryptographer->GetEncryptedTypes(); |
43 sync_pb::EntitySpecifics generated_specifics; | 43 sync_pb::EntitySpecifics generated_specifics; |
44 if (!SpecificsNeedsEncryption(encrypted_types, new_specifics) || | 44 if (!SpecificsNeedsEncryption(encrypted_types, new_specifics) || |
45 !cryptographer->is_initialized()) { | 45 !cryptographer->is_initialized()) { |
46 // No encryption required or we are unable to encrypt. | 46 // No encryption required or we are unable to encrypt. |
47 generated_specifics.CopyFrom(new_specifics); | 47 generated_specifics.CopyFrom(new_specifics); |
48 } else { | 48 } else { |
49 // Encrypt new_specifics into generated_specifics. | 49 // Encrypt new_specifics into generated_specifics. |
50 if (VLOG_IS_ON(2)) { | 50 if (VLOG_IS_ON(2)) { |
51 scoped_ptr<DictionaryValue> value(entry->ToValue()); | 51 scoped_ptr<DictionaryValue> value(entry->ToValue()); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics(); | 519 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics(); |
520 new_value.set_favicon(bytes.empty() ? NULL : &bytes[0], bytes.size()); | 520 new_value.set_favicon(bytes.empty() ? NULL : &bytes[0], bytes.size()); |
521 SetBookmarkSpecifics(new_value); | 521 SetBookmarkSpecifics(new_value); |
522 } | 522 } |
523 | 523 |
524 void WriteNode::MarkForSyncing() { | 524 void WriteNode::MarkForSyncing() { |
525 syncable::MarkForSyncing(entry_); | 525 syncable::MarkForSyncing(entry_); |
526 } | 526 } |
527 | 527 |
528 } // namespace sync_api | 528 } // namespace sync_api |
OLD | NEW |