| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // BookmarkCodec is responsible for encoding and decoding the BookmarkModel | 5 // BookmarkCodec is responsible for encoding and decoding the BookmarkModel |
| 6 // into JSON values. The encoded values are written to disk via the | 6 // into JSON values. The encoded values are written to disk via the |
| 7 // BookmarkService. | 7 // BookmarkService. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ | 9 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ |
| 10 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ | 10 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ |
| 11 | 11 |
| 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 | 14 |
| 14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 15 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 16 #include "base/md5.h" | 17 #include "base/md5.h" |
| 17 | 18 |
| 18 class BookmarkModel; | 19 class BookmarkModel; |
| 19 class BookmarkNode; | 20 class BookmarkNode; |
| 20 class DictionaryValue; | 21 class DictionaryValue; |
| 21 class ListValue; | 22 class ListValue; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void UpdateChecksumWithFolderNode(const std::string& id, | 131 void UpdateChecksumWithFolderNode(const std::string& id, |
| 131 const std::wstring& title); | 132 const std::wstring& title); |
| 132 | 133 |
| 133 // Initializes/Finalizes the checksum. | 134 // Initializes/Finalizes the checksum. |
| 134 void InitializeChecksum(); | 135 void InitializeChecksum(); |
| 135 void FinalizeChecksum(); | 136 void FinalizeChecksum(); |
| 136 | 137 |
| 137 // Whether or not IDs were reassigned by the codec. | 138 // Whether or not IDs were reassigned by the codec. |
| 138 bool ids_reassigned_; | 139 bool ids_reassigned_; |
| 139 | 140 |
| 140 // Whether or not IDs were missing for some bookmark nodes during decoding. | 141 // Whether or not IDs are valid. This is initially true, but set to false |
| 141 bool ids_missing_; | 142 // if an id is missing or not unique. |
| 143 bool ids_valid_; |
| 144 |
| 145 // Contains the id of each of the nodes found in the file. Used to determine |
| 146 // if we have duplicates. |
| 147 std::set<int64> ids_; |
| 142 | 148 |
| 143 // MD5 context used to compute MD5 hash of all bookmark data. | 149 // MD5 context used to compute MD5 hash of all bookmark data. |
| 144 MD5Context md5_context_; | 150 MD5Context md5_context_; |
| 145 | 151 |
| 146 // Checksums. | 152 // Checksums. |
| 147 std::string computed_checksum_; | 153 std::string computed_checksum_; |
| 148 std::string stored_checksum_; | 154 std::string stored_checksum_; |
| 149 | 155 |
| 150 // Maximum ID assigned when decoding data. | 156 // Maximum ID assigned when decoding data. |
| 151 int64 maximum_id_; | 157 int64 maximum_id_; |
| 152 | 158 |
| 153 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); | 159 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); |
| 154 }; | 160 }; |
| 155 | 161 |
| 156 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ | 162 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ |
| OLD | NEW |