Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 void BookmarkStorage::DoLoadBookmarks(const FilePath& path) { | 137 void BookmarkStorage::DoLoadBookmarks(const FilePath& path) { |
| 138 BrowserThread::PostTask( | 138 BrowserThread::PostTask( |
| 139 BrowserThread::FILE, FROM_HERE, | 139 BrowserThread::FILE, FROM_HERE, |
| 140 base::Bind(&LoadCallback, path, make_scoped_refptr(this), | 140 base::Bind(&LoadCallback, path, make_scoped_refptr(this), |
| 141 details_.get())); | 141 details_.get())); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void BookmarkStorage::MigrateFromHistory() { | 144 void BookmarkStorage::MigrateFromHistory() { |
| 145 // We need to wait until history has finished loading before reading | 145 // We need to wait until history has finished loading before reading |
| 146 // from generated bookmarks file. | 146 // from generated bookmarks file. |
| 147 HistoryService* history = | 147 HistoryService* history = HistoryServiceFactory::GetForProfileIfExists( |
|
sky
2012/06/21 17:14:31
Keep this as it was.
| |
| 148 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 148 profile_, Profile::EXPLICIT_ACCESS); |
| 149 if (!history) { | 149 if (!history) { |
| 150 // This happens in unit tests. | 150 // This happens in unit tests. |
| 151 if (model_) | 151 if (model_) |
| 152 model_->DoneLoading(details_.release()); | 152 model_->DoneLoading(details_.release()); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 if (!history->BackendLoaded()) { | 155 if (!history->BackendLoaded()) { |
| 156 // The backend isn't finished loading. Wait for it. | 156 // The backend isn't finished loading. Wait for it. |
| 157 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, | 157 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, |
| 158 content::Source<Profile>(profile_)); | 158 content::Source<Profile>(profile_)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 NOTREACHED(); | 240 NOTREACHED(); |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 std::string data; | 244 std::string data; |
| 245 if (!SerializeData(&data)) | 245 if (!SerializeData(&data)) |
| 246 return false; | 246 return false; |
| 247 writer_.WriteNow(data); | 247 writer_.WriteNow(data); |
| 248 return true; | 248 return true; |
| 249 } | 249 } |
| OLD | NEW |