Commit 5114d186 authored by rlp@chromium.org's avatar rlp@chromium.org

Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS.

BUG=112525

Review URL: https://chromiumcodereview.appspot.com/10831061

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149063 0039d316-1c4b-4281-b951-d872f2087c98
parent 32e757aa
......@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/importer/firefox_profile_lock.h"
#include "chrome/browser/importer/importer.h"
......@@ -190,7 +191,7 @@ ImporterHost::~ImporterHost() {
if (installed_bookmark_observer_) {
DCHECK(profile_);
profile_->GetBookmarkModel()->RemoveObserver(this);
BookmarkModelFactory::GetForProfile(profile_)->RemoveObserver(this);
}
}
......@@ -218,7 +219,7 @@ void ImporterHost::CheckForLoadedModels(uint16 items) {
// BookmarkModel should be loaded before adding IE favorites. So we observe
// the BookmarkModel if needed, and start the task after it has been loaded.
if ((items & importer::FAVORITES) && !writer_->BookmarkModelIsLoaded()) {
profile_->GetBookmarkModel()->AddObserver(this);
BookmarkModelFactory::GetForProfile(profile_)->AddObserver(this);
waiting_for_bookmarkbar_model_ = true;
installed_bookmark_observer_ = true;
}
......
......@@ -13,6 +13,7 @@
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/password_manager/password_store_factory.h"
......@@ -82,7 +83,7 @@ bool ProfileWriter::BookmarkEntry::operator==(
ProfileWriter::ProfileWriter(Profile* profile) : profile_(profile) {}
bool ProfileWriter::BookmarkModelIsLoaded() const {
return profile_->GetBookmarkModel()->IsLoaded();
return BookmarkModelFactory::GetForProfile(profile_)->IsLoaded();
}
bool ProfileWriter::TemplateURLServiceIsLoaded() const {
......@@ -123,7 +124,7 @@ void ProfileWriter::AddBookmarks(const std::vector<BookmarkEntry>& bookmarks,
if (bookmarks.empty())
return;
BookmarkModel* model = profile_->GetBookmarkModel();
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
DCHECK(model->IsLoaded());
// If the bookmark bar is currently empty, we should import directly to it.
......
......@@ -13,6 +13,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/history/history.h"
......@@ -222,9 +223,9 @@ TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) {
EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1,
Profile::EXPLICIT_ACCESS));
profile1->CreateBookmarkModel(true);
EXPECT_TRUE(profile1->GetBookmarkModel());
EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1));
profile2->CreateBookmarkModel(true);
EXPECT_TRUE(profile2->GetBookmarkModel());
EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2));
profile2->CreateHistoryService(true, false);
EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2,
Profile::EXPLICIT_ACCESS));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment