From 3b2af1d3dbeaceae71f2c294e761707b1947b623 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Wed, 28 Nov 2012 17:12:57 +0000 Subject: bookmarks: Pass BrowserContext to BookmarkIndex. We are switching away from Profile, and content::BrowserContext is preferred over it. BUG=144783 R=sky@chromium.org Review URL: https://codereview.chromium.org/11411225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169974 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/bookmarks/bookmark_index.cc | 10 ++++++---- chrome/browser/bookmarks/bookmark_index.h | 10 ++++++---- chrome/browser/bookmarks/bookmark_model.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'chrome/browser/bookmarks') diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index 9fa3fcb..6b21f03 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -52,7 +52,8 @@ BookmarkIndex::NodeSet::const_iterator BookmarkIndex::Match::nodes_end() const { return nodes.empty() ? terms.front()->second.end() : nodes.end(); } -BookmarkIndex::BookmarkIndex(Profile* profile) : profile_(profile) { +BookmarkIndex::BookmarkIndex(content::BrowserContext* browser_context) + : browser_context_(browser_context) { } BookmarkIndex::~BookmarkIndex() { @@ -111,9 +112,10 @@ void BookmarkIndex::GetBookmarksWithTitlesMatching( void BookmarkIndex::SortMatches(const Matches& matches, NodeTypedCountPairs* node_typed_counts) const { - HistoryService* const history_service = profile_ ? - HistoryServiceFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS) : NULL; + HistoryService* const history_service = browser_context_ ? + HistoryServiceFactory::GetForProfile( + Profile::FromBrowserContext(browser_context_), + Profile::EXPLICIT_ACCESS) : NULL; history::URLDatabase* url_db = history_service ? history_service->InMemoryDatabase() : NULL; diff --git a/chrome/browser/bookmarks/bookmark_index.h b/chrome/browser/bookmarks/bookmark_index.h index a955707..942a376 100644 --- a/chrome/browser/bookmarks/bookmark_index.h +++ b/chrome/browser/bookmarks/bookmark_index.h @@ -13,7 +13,6 @@ #include "base/string16.h" class BookmarkNode; -class Profile; class QueryNode; class QueryParser; @@ -21,6 +20,10 @@ namespace bookmark_utils { struct TitleMatch; } +namespace content { +class BrowserContext; +} + namespace history { class URLDatabase; } @@ -32,10 +35,9 @@ class URLDatabase; // BookmarkIndex maintains the index (index_) as a map of sets. The map (type // Index) maps from a lower case string to the set (type NodeSet) of // BookmarkNodes that contain that string in their title. - class BookmarkIndex { public: - explicit BookmarkIndex(Profile* profile); + explicit BookmarkIndex(content::BrowserContext* browser_context); ~BookmarkIndex(); // Invoked when a bookmark has been added to the model. @@ -127,7 +129,7 @@ class BookmarkIndex { Index index_; - Profile* profile_; + content::BrowserContext* browser_context_; DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); }; diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index 91d960e..b5089e7 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -251,7 +251,7 @@ class BookmarkModel : public content::NotificationObserver, node == mobile_node_; } - Profile* profile() const { return profile_; } + Profile* profile() { return profile_; } // Returns the parent the last node was added to. This never returns NULL // (as long as the model is loaded). -- cgit v1.1