summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_storage.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 23:14:46 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 23:14:46 +0000
commit42eb6b07c2791d8d13ec48ea3c92725eee4d94a2 (patch)
tree9c72c5052409725827617584d7891f1fcd5b5c9e /chrome/browser/bookmarks/bookmark_storage.cc
parent60aac62ddf3cc40741a824cae25ab190005513be (diff)
downloadchromium_src-42eb6b07c2791d8d13ec48ea3c92725eee4d94a2.zip
chromium_src-42eb6b07c2791d8d13ec48ea3c92725eee4d94a2.tar.gz
chromium_src-42eb6b07c2791d8d13ec48ea3c92725eee4d94a2.tar.bz2
Port some files in chrome/browser/ - part 1.
Review URL: http://codereview.chromium.org/11402 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_storage.cc')
-rw-r--r--chrome/browser/bookmarks/bookmark_storage.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc
index eb9bbe4..591f190 100644
--- a/chrome/browser/bookmarks/bookmark_storage.cc
+++ b/chrome/browser/bookmarks/bookmark_storage.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
+#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/json_writer.h"
#include "base/message_loop.h"
@@ -31,8 +32,7 @@ const int kSaveDelayMS = 2500;
BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkModel* model)
: model_(model),
-#pragma warning(suppress: 4355) // Okay to pass "this" here.
- save_factory_(this),
+ ALLOW_THIS_IN_INITIALIZER_LIST(save_factory_(this)),
backend_thread_(g_browser_process->file_thread()) {
std::wstring path = profile->GetPath();
file_util::AppendToPath(&path, chrome::kBookmarksFileName);
@@ -139,13 +139,10 @@ void BookmarkStorageBackend::Write(Value* value) {
int bytes_written = file_util::WriteFile(tmp_file, content.c_str(),
static_cast<int>(content.length()));
if (bytes_written != -1) {
- if (!MoveFileEx(tmp_file.c_str(), path_.c_str(),
- MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) {
+ if (!file_util::Move(tmp_file, path_)) {
// Rename failed. Try again on the off chance someone has locked either
// file and hope we're successful the second time through.
- BOOL move_result =
- MoveFileEx(tmp_file.c_str(), path_.c_str(),
- MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
+ bool move_result = file_util::Move(tmp_file, path_);
DCHECK(move_result);
if (!move_result)
LOG(WARNING) << " writing bookmarks failed, result=" << move_result;