Index: chrome/browser/bookmarks/bookmark_model_factory.cc |
diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc |
index c54cff9c1285df3827e68aa987686022c4355fac..a7c1a6e7d5d51101c65368b1cdfd340354a6c5e2 100644 |
--- a/chrome/browser/bookmarks/bookmark_model_factory.cc |
+++ b/chrome/browser/bookmarks/bookmark_model_factory.cc |
@@ -19,16 +19,19 @@ |
#include "components/bookmarks/core/common/bookmark_pref_names.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
+#include "content/public/browser/browser_thread.h" |
// static |
BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) { |
- return static_cast<BookmarkModel*>( |
+ ChromeBookmarkClient* bookmark_client = static_cast<ChromeBookmarkClient*>( |
GetInstance()->GetServiceForBrowserContext(profile, true)); |
+ return bookmark_client ? bookmark_client->model() : NULL; |
} |
BookmarkModel* BookmarkModelFactory::GetForProfileIfExists(Profile* profile) { |
- return static_cast<BookmarkModel*>( |
+ ChromeBookmarkClient* bookmark_client = static_cast<ChromeBookmarkClient*>( |
GetInstance()->GetServiceForBrowserContext(profile, false)); |
+ return bookmark_client ? bookmark_client->model() : NULL; |
} |
// static |
@@ -47,17 +50,22 @@ BookmarkModelFactory::~BookmarkModelFactory() {} |
KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
content::BrowserContext* context) const { |
Profile* profile = static_cast<Profile*>(context); |
- BookmarkModel* bookmark_model = new BookmarkModel(profile); |
- bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> |
- GetBookmarkTaskRunner()); |
+ ChromeBookmarkClient* bookmark_client = new ChromeBookmarkClient(profile); |
+ bookmark_client->model()->Load( |
+ profile->GetPrefs(), |
+ profile->GetPath(), |
+ StartupTaskRunnerServiceFactory::GetForProfile(profile) |
+ ->GetBookmarkTaskRunner(), |
+ content::BrowserThread::GetMessageLoopProxyForThread( |
+ content::BrowserThread::UI)); |
#if !defined(OS_ANDROID) |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableBookmarkUndo)) { |
- bookmark_model->AddObserver( |
+ bookmark_client->model()->AddObserver( |
BookmarkUndoServiceFactory::GetForProfile(profile)); |
} |
#endif // !defined(OS_ANDROID) |
- return bookmark_model; |
+ return bookmark_client; |
} |
void BookmarkModelFactory::RegisterProfilePrefs( |