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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" 5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 mojo::Binding<SiteEngagementUIHandler> binding_; 70 mojo::Binding<SiteEngagementUIHandler> binding_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(SiteEngagementUIHandlerImpl); 72 DISALLOW_COPY_AND_ASSIGN(SiteEngagementUIHandlerImpl);
73 }; 73 };
74 74
75 } // namespace 75 } // namespace
76 76
77 SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) 77 SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
78 : MojoWebUIController<SiteEngagementUIHandler>(web_ui) { 78 : MojoWebUIController<SiteEngagementUIHandler>(web_ui) {
79 // Incognito profiles will not have a site engagement service.
80 Profile* profile = Profile::FromWebUI(web_ui);
81 if (!SiteEngagementService::Get(profile))
82 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
83
79 // Set up the chrome://site-engagement/ source. 84 // Set up the chrome://site-engagement/ source.
80 scoped_ptr<content::WebUIDataSource> source( 85 scoped_ptr<content::WebUIDataSource> source(
81 content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost)); 86 content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost));
82 source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS); 87 source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS);
83 source->AddResourcePath( 88 source->AddResourcePath(
84 "chrome/browser/ui/webui/engagement/site_engagement.mojom", 89 "chrome/browser/ui/webui/engagement/site_engagement.mojom",
85 IDR_SITE_ENGAGEMENT_MOJO_JS); 90 IDR_SITE_ENGAGEMENT_MOJO_JS);
86 source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); 91 source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML);
87 92 content::WebUIDataSource::Add(profile, source.release());
88 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release());
89 } 93 }
90 94
91 SiteEngagementUI::~SiteEngagementUI() {} 95 SiteEngagementUI::~SiteEngagementUI() {}
92 96
93 void SiteEngagementUI::BindUIHandler( 97 void SiteEngagementUI::BindUIHandler(
94 mojo::InterfaceRequest<SiteEngagementUIHandler> request) { 98 mojo::InterfaceRequest<SiteEngagementUIHandler> request) {
95 ui_handler_.reset(new SiteEngagementUIHandlerImpl( 99 ui_handler_.reset(new SiteEngagementUIHandlerImpl(
96 Profile::FromWebUI(web_ui()), std::move(request))); 100 Profile::FromWebUI(web_ui()), std::move(request)));
97 } 101 }
OLDNEW
« 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