diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 02:16:05 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 02:16:05 +0000 |
commit | 8c4a580917a5f379b4a9e67145ed78a347151181 (patch) | |
tree | 4660d34698629c72ba45dba260d4c970864f6c49 /chrome/browser/bookmarks/bookmark_storage.cc | |
parent | 60142d98de42fad6bc63b37b063d565a3ab85f0b (diff) | |
download | chromium_src-8c4a580917a5f379b4a9e67145ed78a347151181.zip chromium_src-8c4a580917a5f379b4a9e67145ed78a347151181.tar.gz chromium_src-8c4a580917a5f379b4a9e67145ed78a347151181.tar.bz2 |
Bring a bunch more headers into the non-Windows build:
- history
- autocomplete
- bookmarks
These were all reviewed separately but turned out to be interdependent. :~(
Review URL: http://codereview.chromium.org/21170
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_storage.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_storage.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index 4f2ae9f..64743e5 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -19,11 +19,11 @@ namespace { // Extension used for backup files (copy of main file created during startup). -const wchar_t* const kBackupExtension = L"bak"; +const FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); // Extension for the temporary file. We write to the temp file than move to // kBookmarksFileName. -const wchar_t* const kTmpExtension = L"tmp"; +const FilePath::CharType kTmpExtension[] = FILE_PATH_LITERAL("tmp"); // How often we save. const int kSaveDelayMS = 2500; @@ -36,10 +36,9 @@ BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkModel* model) : model_(model), ALLOW_THIS_IN_INITIALIZER_LIST(save_factory_(this)), backend_thread_(g_browser_process->file_thread()) { - std::wstring path = profile->GetPath().ToWStringHack(); - file_util::AppendToPath(&path, chrome::kBookmarksFileName); - std::wstring tmp_history_path = profile->GetPath().ToWStringHack(); - file_util::AppendToPath(&tmp_history_path, chrome::kHistoryBookmarksFileName); + FilePath path = profile->GetPath().Append(chrome::kBookmarksFileName); + FilePath tmp_history_path = + profile->GetPath().Append(chrome::kHistoryBookmarksFileName); backend_ = new BookmarkStorageBackend(path, tmp_history_path); } @@ -115,13 +114,12 @@ void BookmarkStorage::SaveNow() { // BookmarkStorageBackend ------------------------------------------------------ BookmarkStorageBackend::BookmarkStorageBackend( - const std::wstring& path, - const std::wstring& tmp_history_path) - : path_(path), - tmp_history_path_(tmp_history_path) { + const FilePath& path, + const FilePath& tmp_history_path) + : path_(path.ToWStringHack()), + tmp_history_path_(tmp_history_path.ToWStringHack()) { // Make a backup of the current file. - std::wstring backup_path = path; - file_util::ReplaceExtension(&backup_path, kBackupExtension); + FilePath backup_path = path.ReplaceExtension(kBackupExtension); file_util::CopyFile(path, backup_path); } @@ -135,8 +133,11 @@ void BookmarkStorageBackend::Write(Value* value) { JSONWriter::Write(value, true, &content); // Write to a temp file, then rename. - std::wstring tmp_file = path_; - file_util::ReplaceExtension(&tmp_file, kTmpExtension); + // TODO(port): this code was all written to use wstrings; needs cleaning up + // for FilePath. + FilePath tmp_file_filepath = + FilePath::FromWStringHack(path_).ReplaceExtension(kTmpExtension); + std::wstring tmp_file = tmp_file_filepath.ToWStringHack(); int bytes_written = file_util::WriteFile(tmp_file, content.c_str(), static_cast<int>(content.length())); |