| 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 #include "components/bookmarks/browser/bookmark_storage.h" | 5 #include "components/bookmarks/browser/bookmark_storage.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/json/json_file_value_serializer.h" | 14 #include "base/json/json_file_value_serializer.h" |
| 15 #include "base/json/json_reader.h" | 15 #include "base/json/json_reader.h" |
| 16 #include "base/json/json_string_value_serializer.h" | 16 #include "base/json/json_string_value_serializer.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/sequenced_task_runner.h" | 18 #include "base/sequenced_task_runner.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "components/bookmarks/browser/bookmark_codec.h" | 20 #include "components/bookmarks/browser/bookmark_codec.h" |
| 21 #include "components/bookmarks/browser/bookmark_index.h" | |
| 22 #include "components/bookmarks/browser/bookmark_model.h" | 21 #include "components/bookmarks/browser/bookmark_model.h" |
| 22 #include "components/bookmarks/browser/titled_url_index.h" |
| 23 #include "components/bookmarks/common/bookmark_constants.h" | 23 #include "components/bookmarks/common/bookmark_constants.h" |
| 24 | 24 |
| 25 using base::TimeTicks; | 25 using base::TimeTicks; |
| 26 | 26 |
| 27 namespace bookmarks { | 27 namespace bookmarks { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Extension used for backup files (copy of main file created during startup). | 31 // Extension used for backup files (copy of main file created during startup). |
| 32 const base::FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); | 32 const base::FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 } // namespace | 118 } // namespace |
| 119 | 119 |
| 120 // BookmarkLoadDetails --------------------------------------------------------- | 120 // BookmarkLoadDetails --------------------------------------------------------- |
| 121 | 121 |
| 122 BookmarkLoadDetails::BookmarkLoadDetails( | 122 BookmarkLoadDetails::BookmarkLoadDetails( |
| 123 BookmarkPermanentNode* bb_node, | 123 BookmarkPermanentNode* bb_node, |
| 124 BookmarkPermanentNode* other_folder_node, | 124 BookmarkPermanentNode* other_folder_node, |
| 125 BookmarkPermanentNode* mobile_folder_node, | 125 BookmarkPermanentNode* mobile_folder_node, |
| 126 const LoadExtraCallback& load_extra_callback, | 126 const LoadExtraCallback& load_extra_callback, |
| 127 BookmarkIndex* index, | 127 TitledUrlIndex* index, |
| 128 int64_t max_id) | 128 int64_t max_id) |
| 129 : bb_node_(bb_node), | 129 : bb_node_(bb_node), |
| 130 other_folder_node_(other_folder_node), | 130 other_folder_node_(other_folder_node), |
| 131 mobile_folder_node_(mobile_folder_node), | 131 mobile_folder_node_(mobile_folder_node), |
| 132 load_extra_callback_(load_extra_callback), | 132 load_extra_callback_(load_extra_callback), |
| 133 index_(index), | 133 index_(index), |
| 134 model_sync_transaction_version_( | 134 model_sync_transaction_version_( |
| 135 BookmarkNode::kInvalidSyncTransactionVersion), | 135 BookmarkNode::kInvalidSyncTransactionVersion), |
| 136 max_id_(max_id), | 136 max_id_(max_id), |
| 137 ids_reassigned_(false) {} | 137 ids_reassigned_(false) {} |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 | 230 |
| 231 std::unique_ptr<std::string> data(new std::string); | 231 std::unique_ptr<std::string> data(new std::string); |
| 232 if (!SerializeData(data.get())) | 232 if (!SerializeData(data.get())) |
| 233 return false; | 233 return false; |
| 234 writer_.WriteNow(std::move(data)); | 234 writer_.WriteNow(std::move(data)); |
| 235 return true; | 235 return true; |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace bookmarks | 238 } // namespace bookmarks |
| OLD | NEW |