| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ |
| 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 9 #include <set> | 11 #include <set> |
| 10 #include <string> | 12 #include <string> |
| 11 | 13 |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/md5.h" | 15 #include "base/md5.h" |
| 14 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 15 #include "components/bookmarks/browser/bookmark_node.h" | 17 #include "components/bookmarks/browser/bookmark_node.h" |
| 16 | 18 |
| 17 namespace base { | 19 namespace base { |
| 18 class DictionaryValue; | 20 class DictionaryValue; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 static const char kChildrenKey[]; | 103 static const char kChildrenKey[]; |
| 102 static const char kMetaInfo[]; | 104 static const char kMetaInfo[]; |
| 103 static const char kSyncTransactionVersion[]; | 105 static const char kSyncTransactionVersion[]; |
| 104 | 106 |
| 105 // Possible values for kTypeKey. | 107 // Possible values for kTypeKey. |
| 106 static const char kTypeURL[]; | 108 static const char kTypeURL[]; |
| 107 static const char kTypeFolder[]; | 109 static const char kTypeFolder[]; |
| 108 | 110 |
| 109 private: | 111 private: |
| 110 // Encodes node and all its children into a Value object and returns it. | 112 // Encodes node and all its children into a Value object and returns it. |
| 111 // The caller takes ownership of the returned object. | 113 std::unique_ptr<base::Value> EncodeNode(const BookmarkNode* node); |
| 112 base::Value* EncodeNode(const BookmarkNode* node); | |
| 113 | 114 |
| 114 // Encodes the given meta info into a Value object and returns it. The caller | 115 // Encodes the given meta info into a Value object and returns it. The caller |
| 115 // takes ownership of the returned object. | 116 // takes ownership of the returned object. |
| 116 base::Value* EncodeMetaInfo(const BookmarkNode::MetaInfoMap& meta_info_map); | 117 base::Value* EncodeMetaInfo(const BookmarkNode::MetaInfoMap& meta_info_map); |
| 117 | 118 |
| 118 // Helper to perform decoding. | 119 // Helper to perform decoding. |
| 119 bool DecodeHelper(BookmarkNode* bb_node, | 120 bool DecodeHelper(BookmarkNode* bb_node, |
| 120 BookmarkNode* other_folder_node, | 121 BookmarkNode* other_folder_node, |
| 121 BookmarkNode* mobile_folder_node, | 122 BookmarkNode* mobile_folder_node, |
| 122 const base::Value& value); | 123 const base::Value& value); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 // Sync transaction version set on bookmark model root. | 205 // Sync transaction version set on bookmark model root. |
| 205 int64_t model_sync_transaction_version_; | 206 int64_t model_sync_transaction_version_; |
| 206 | 207 |
| 207 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); | 208 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 } // namespace bookmarks | 211 } // namespace bookmarks |
| 211 | 212 |
| 212 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ | 213 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CODEC_H_ |
| OLD | NEW |