Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/bookmarks/bookmark_storage.cc

Issue 1912: Renames BoomarkBarModel to BookmarkModel. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json_writer.h" 8 #include "base/json_writer.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/bookmarks/bookmark_bar_model.h"
11 #include "chrome/browser/bookmarks/bookmark_codec.h" 10 #include "chrome/browser/bookmarks/bookmark_codec.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/profile.h" 12 #include "chrome/browser/profile.h"
13 #include "chrome/common/chrome_constants.h" 13 #include "chrome/common/chrome_constants.h"
14 #include "chrome/common/json_value_serializer.h" 14 #include "chrome/common/json_value_serializer.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Extension used for backup files (copy of main file created during startup). 18 // Extension used for backup files (copy of main file created during startup).
19 const wchar_t* const kBackupExtension = L"bak"; 19 const wchar_t* const kBackupExtension = L"bak";
20 20
21 // Extension for the temporary file. We write to the temp file than move to 21 // Extension for the temporary file. We write to the temp file than move to
22 // kBookmarksFileName. 22 // kBookmarksFileName.
23 const wchar_t* const kTmpExtension = L"tmp"; 23 const wchar_t* const kTmpExtension = L"tmp";
24 24
25 // How often we save. 25 // How often we save.
26 const int kSaveDelayMS = 2500; 26 const int kSaveDelayMS = 2500;
27 27
28 } // namespace 28 } // namespace
29 29
30 // BookmarkStorage ------------------------------------------------------------- 30 // BookmarkStorage -------------------------------------------------------------
31 31
32 BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkBarModel* model) 32 BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkModel* model)
33 : model_(model), 33 : model_(model),
34 #pragma warning(suppress: 4355) // Okay to pass "this" here. 34 #pragma warning(suppress: 4355) // Okay to pass "this" here.
35 save_factory_(this), 35 save_factory_(this),
36 backend_thread_(g_browser_process->file_thread()) { 36 backend_thread_(g_browser_process->file_thread()) {
37 std::wstring path = profile->GetPath(); 37 std::wstring path = profile->GetPath();
38 file_util::AppendToPath(&path, chrome::kBookmarksFileName); 38 file_util::AppendToPath(&path, chrome::kBookmarksFileName);
39 std::wstring tmp_history_path = profile->GetPath(); 39 std::wstring tmp_history_path = profile->GetPath();
40 file_util::AppendToPath(&tmp_history_path, chrome::kHistoryBookmarksFileName); 40 file_util::AppendToPath(&tmp_history_path, chrome::kHistoryBookmarksFileName);
41 backend_ = new BookmarkStorageBackend(path, tmp_history_path); 41 backend_ = new BookmarkStorageBackend(path, tmp_history_path);
42 } 42 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // BookmarkStorage takes ownership of root. 167 // BookmarkStorage takes ownership of root.
168 if (message_loop) { 168 if (message_loop) {
169 message_loop->PostTask(FROM_HERE, NewRunnableMethod( 169 message_loop->PostTask(FROM_HERE, NewRunnableMethod(
170 service.get(), &BookmarkStorage::LoadedBookmarks, root, 170 service.get(), &BookmarkStorage::LoadedBookmarks, root,
171 bookmark_file_exists, load_from_history)); 171 bookmark_file_exists, load_from_history));
172 } else { 172 } else {
173 service->LoadedBookmarks(root, bookmark_file_exists, load_from_history); 173 service->LoadedBookmarks(root, bookmark_file_exists, load_from_history);
174 } 174 }
175 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698