OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_ |
(...skipping 15 matching lines...) Expand all Loading... |
26 // BookmarkCodec is responsible for encoding/decoding bookmarks into JSON | 26 // BookmarkCodec is responsible for encoding/decoding bookmarks into JSON |
27 // values. BookmarkCodec is used by BookmarkService. | 27 // values. BookmarkCodec is used by BookmarkService. |
28 | 28 |
29 class BookmarkCodec { | 29 class BookmarkCodec { |
30 public: | 30 public: |
31 // Creates an instance of the codec. During decoding, if the IDs in the file | 31 // Creates an instance of the codec. During decoding, if the IDs in the file |
32 // are not unique, we will reassign IDs to make them unique. There are no | 32 // are not unique, we will reassign IDs to make them unique. There are no |
33 // guarantees on how the IDs are reassigned or about doing minimal | 33 // guarantees on how the IDs are reassigned or about doing minimal |
34 // reassignments to achieve uniqueness. | 34 // reassignments to achieve uniqueness. |
35 BookmarkCodec(); | 35 BookmarkCodec(); |
| 36 ~BookmarkCodec(); |
36 | 37 |
37 // Encodes the model to a JSON value. It's up to the caller to delete the | 38 // Encodes the model to a JSON value. It's up to the caller to delete the |
38 // returned object. This is invoked to encode the contents of the bookmark bar | 39 // returned object. This is invoked to encode the contents of the bookmark bar |
39 // model and is currently a convenience to invoking Encode that takes the | 40 // model and is currently a convenience to invoking Encode that takes the |
40 // bookmark bar node and other folder node. | 41 // bookmark bar node and other folder node. |
41 Value* Encode(BookmarkModel* model); | 42 Value* Encode(BookmarkModel* model); |
42 | 43 |
43 // Encodes the bookmark bar and other folders returning the JSON value. It's | 44 // Encodes the bookmark bar and other folders returning the JSON value. It's |
44 // up to the caller to delete the returned object. | 45 // up to the caller to delete the returned object. |
45 // This method is public for use by StarredURLDatabase in migrating the | 46 // This method is public for use by StarredURLDatabase in migrating the |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 std::string computed_checksum_; | 156 std::string computed_checksum_; |
156 std::string stored_checksum_; | 157 std::string stored_checksum_; |
157 | 158 |
158 // Maximum ID assigned when decoding data. | 159 // Maximum ID assigned when decoding data. |
159 int64 maximum_id_; | 160 int64 maximum_id_; |
160 | 161 |
161 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); | 162 DISALLOW_COPY_AND_ASSIGN(BookmarkCodec); |
162 }; | 163 }; |
163 | 164 |
164 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ | 165 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_ |
OLD | NEW |