| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/json/json_value_serializer.h" | 10 #include "base/json/json_value_serializer.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_codec.h" | 13 #include "chrome/browser/bookmarks/bookmark_codec.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 | 20 |
| 21 using base::TimeTicks; | 21 using base::TimeTicks; |
| 22 using content::BrowserThread; |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Extension used for backup files (copy of main file created during startup). | 26 // Extension used for backup files (copy of main file created during startup). |
| 26 const FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); | 27 const FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); |
| 27 | 28 |
| 28 // How often we save. | 29 // How often we save. |
| 29 const int kSaveDelayMS = 2500; | 30 const int kSaveDelayMS = 2500; |
| 30 | 31 |
| 31 class BackupTask : public Task { | 32 class BackupTask : public Task { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 NOTREACHED(); | 261 NOTREACHED(); |
| 261 return false; | 262 return false; |
| 262 } | 263 } |
| 263 | 264 |
| 264 std::string data; | 265 std::string data; |
| 265 if (!SerializeData(&data)) | 266 if (!SerializeData(&data)) |
| 266 return false; | 267 return false; |
| 267 writer_.WriteNow(data); | 268 writer_.WriteNow(data); |
| 268 return true; | 269 return true; |
| 269 } | 270 } |
| OLD | NEW |