Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8359)

Unified Diff: chrome/browser/ui/webui/popular_sites_internals_message_handler.cc

Issue 1919043005: Remove Profile dependency from PopularSites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
diff --git a/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc b/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
index d6a1c3bcea7547bed209d94c47a7f15433bb9747..9534044af3b1c1f3e2929264c5974cec12b53a14 100644
--- a/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
@@ -14,6 +14,7 @@
#include "base/values.h"
#include "chrome/browser/android/ntp/popular_sites.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "components/url_formatter/url_fixer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_ui.h"
@@ -55,8 +56,12 @@ void PopularSitesInternalsMessageHandler::HandleRegisterForEvents(
std::string country;
std::string version;
+ Profile* profile = Profile::FromWebUI(web_ui());
popular_sites_.reset(new PopularSites(
- Profile::FromWebUI(web_ui()), country, version, false,
+ profile->GetPrefs(),
+ TemplateURLServiceFactory::GetForProfile(profile),
+ profile->GetRequestContext(),
+ country, version, false,
base::Bind(&PopularSitesInternalsMessageHandler::OnPopularSitesAvailable,
base::Unretained(this), false)));
}
@@ -64,6 +69,7 @@ void PopularSitesInternalsMessageHandler::HandleRegisterForEvents(
void PopularSitesInternalsMessageHandler::HandleDownload(
const base::ListValue* args) {
DCHECK_EQ(3u, args->GetSize());
+ Profile* profile = Profile::FromWebUI(web_ui());
auto callback =
base::Bind(&PopularSitesInternalsMessageHandler::OnPopularSitesAvailable,
base::Unretained(this), true);
@@ -72,7 +78,9 @@ void PopularSitesInternalsMessageHandler::HandleDownload(
args->GetString(0, &url);
if (!url.empty()) {
popular_sites_.reset(new PopularSites(
- Profile::FromWebUI(web_ui()),
+ profile->GetPrefs(),
+ TemplateURLServiceFactory::GetForProfile(profile),
+ profile->GetRequestContext(),
url_formatter::FixupURL(url, std::string()), callback));
return;
}
@@ -80,8 +88,11 @@ void PopularSitesInternalsMessageHandler::HandleDownload(
args->GetString(1, &country);
std::string version;
args->GetString(2, &version);
- popular_sites_.reset(new PopularSites(Profile::FromWebUI(web_ui()), country,
- version, true, callback));
+ popular_sites_.reset(new PopularSites(
+ profile->GetPrefs(),
+ TemplateURLServiceFactory::GetForProfile(profile),
+ profile->GetRequestContext(),
+ country, version, true, callback));
}
void PopularSitesInternalsMessageHandler::HandleViewJson(
« chrome/browser/android/ntp/popular_sites.cc ('K') | « chrome/browser/android/ntp/popular_sites.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698