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

Unified Diff: chrome/browser/ui/webui/engagement/site_engagement_ui.cc

Issue 1821563002: Fix chrome://site-engagement in incognito mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/engagement/site_engagement_ui.cc
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
index 0b1eceaead1143046cb2f8ac419210108e031d6b..d53fe7aab36f824aadf4811fbdccf20c0a040281 100644
--- a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
+++ b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
@@ -76,6 +76,11 @@ class SiteEngagementUIHandlerImpl : public SiteEngagementUIHandler {
SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
: MojoWebUIController<SiteEngagementUIHandler>(web_ui) {
+ // Incognito profiles will not have a site engagement service.
+ Profile* profile = Profile::FromWebUI(web_ui);
+ if (!SiteEngagementService::Get(profile))
+ return;
Dan Beam 2016/03/21 17:01:12 you can't return from a ctor
calamity 2016/03/22 04:32:42 Seems to work. http://stackoverflow.com/questions
+
// Set up the chrome://site-engagement/ source.
scoped_ptr<content::WebUIDataSource> source(
content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost));
@@ -84,8 +89,7 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
"chrome/browser/ui/webui/engagement/site_engagement.mojom",
IDR_SITE_ENGAGEMENT_MOJO_JS);
source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML);
-
- content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release());
+ content::WebUIDataSource::Add(profile, source.release());
}
SiteEngagementUI::~SiteEngagementUI() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698