OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/bookmarks/bookmark_storage.h" | 5 #include "chrome/browser/bookmarks/bookmark_storage.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json_writer.h" | 9 #include "base/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 void BookmarkStorageBackend::Read(scoped_refptr<BookmarkStorage> service, | 162 void BookmarkStorageBackend::Read(scoped_refptr<BookmarkStorage> service, |
163 MessageLoop* message_loop, | 163 MessageLoop* message_loop, |
164 bool load_from_history) { | 164 bool load_from_history) { |
165 const std::wstring& path = load_from_history ? tmp_history_path_ : path_; | 165 const std::wstring& path = load_from_history ? tmp_history_path_ : path_; |
166 bool bookmark_file_exists = file_util::PathExists(path); | 166 bool bookmark_file_exists = file_util::PathExists(path); |
167 Value* root = NULL; | 167 Value* root = NULL; |
168 if (bookmark_file_exists) { | 168 if (bookmark_file_exists) { |
169 JSONFileValueSerializer serializer(path); | 169 JSONFileValueSerializer serializer(path); |
170 serializer.Deserialize(&root, NULL); | 170 root = serializer.Deserialize(NULL); |
171 } | 171 } |
172 | 172 |
173 // BookmarkStorage takes ownership of root. | 173 // BookmarkStorage takes ownership of root. |
174 if (message_loop) { | 174 if (message_loop) { |
175 message_loop->PostTask(FROM_HERE, NewRunnableMethod( | 175 message_loop->PostTask(FROM_HERE, NewRunnableMethod( |
176 service.get(), &BookmarkStorage::LoadedBookmarks, root, | 176 service.get(), &BookmarkStorage::LoadedBookmarks, root, |
177 bookmark_file_exists, load_from_history)); | 177 bookmark_file_exists, load_from_history)); |
178 } else { | 178 } else { |
179 service->LoadedBookmarks(root, bookmark_file_exists, load_from_history); | 179 service->LoadedBookmarks(root, bookmark_file_exists, load_from_history); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |