| Index: chrome/browser/ui/webui/ntp/most_visited_handler.cc
|
| diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc
|
| index 704380e324a05f29910a7d72b3a5f9705e57b7c2..4c6c9de2cdecbf5476f9e9cbd805064f9b2f1ae3 100644
|
| --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc
|
| +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc
|
| @@ -22,6 +22,7 @@
|
| #include "base/values.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/history/top_sites.h"
|
| +#include "chrome/browser/history/top_sites_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/thumbnails/thumbnail_list_source.h"
|
| #include "chrome/browser/ui/browser.h"
|
| @@ -83,7 +84,7 @@ void MostVisitedHandler::RegisterMessages() {
|
| content::URLDataSource::Add(
|
| profile, new FaviconSource(profile, FaviconSource::FAVICON));
|
|
|
| - history::TopSites* ts = profile->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts = TopSitesFactory::GetForProfile(profile);
|
| if (ts) {
|
| // TopSites updates itself after a delay. This is especially noticable when
|
| // your profile is empty. Ask TopSites to update itself when we're about to
|
| @@ -138,7 +139,8 @@ void MostVisitedHandler::SendPagesValue() {
|
| const base::DictionaryValue* url_blacklist =
|
| profile->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist);
|
| bool has_blacklisted_urls = !url_blacklist->empty();
|
| - history::TopSites* ts = profile->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts =
|
| + TopSitesFactory::GetForProfile(profile);
|
| if (ts)
|
| has_blacklisted_urls = ts->HasBlacklistedItems();
|
|
|
| @@ -151,7 +153,8 @@ void MostVisitedHandler::SendPagesValue() {
|
| }
|
|
|
| void MostVisitedHandler::StartQueryForMostVisited() {
|
| - history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts =
|
| + TopSitesFactory::GetForProfile(Profile::FromWebUI(web_ui()));
|
| if (ts) {
|
| ts->GetMostVisitedURLs(
|
| base::Bind(&MostVisitedHandler::OnMostVisitedUrlsAvailable,
|
| @@ -177,7 +180,8 @@ void MostVisitedHandler::HandleRemoveUrlsFromBlacklist(
|
| return;
|
| }
|
| content::RecordAction(UserMetricsAction("MostVisited_UrlRemoved"));
|
| - history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts =
|
| + TopSitesFactory::GetForProfile(Profile::FromWebUI(web_ui()));
|
| if (ts)
|
| ts->RemoveBlacklistedURL(GURL(url));
|
| }
|
| @@ -186,7 +190,8 @@ void MostVisitedHandler::HandleRemoveUrlsFromBlacklist(
|
| void MostVisitedHandler::HandleClearBlacklist(const base::ListValue* args) {
|
| content::RecordAction(UserMetricsAction("MostVisited_BlacklistCleared"));
|
|
|
| - history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts =
|
| + TopSitesFactory::GetForProfile(Profile::FromWebUI(web_ui()));
|
| if (ts)
|
| ts->ClearBlacklistedURLs();
|
| }
|
| @@ -253,7 +258,8 @@ void MostVisitedHandler::Observe(int type,
|
| }
|
|
|
| void MostVisitedHandler::BlacklistUrl(const GURL& url) {
|
| - history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
|
| + scoped_refptr<history::TopSites> ts =
|
| + TopSitesFactory::GetForProfile(Profile::FromWebUI(web_ui()));
|
| if (ts)
|
| ts->AddBlacklistedURL(url);
|
| content::RecordAction(UserMetricsAction("MostVisited_UrlBlacklisted"));
|
|
|