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

Unified Diff: chrome/browser/ui/webui/interstitials/interstitial_ui.cc

Issue 2755733002: Include the supervised user interstitial on chrome://interstitials (Closed)
Patch Set: review Created 3 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 | components/security_interstitials/core/browser/resources/interstitial_ui.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/interstitials/interstitial_ui.cc
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index 2317c5b6114b9e777f7d84b59964be7a8d2f5ddb..7845d3f37e86da62b25113a95368115a20e59caa 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -67,8 +67,8 @@ scoped_refptr<net::X509Certificate> CreateFakeCert() {
// not used in displaying any real interstitials.
class InterstitialHTMLSource : public content::URLDataSource {
public:
- explicit InterstitialHTMLSource(Profile* profile) : profile_(profile) {}
- ~InterstitialHTMLSource() override {}
+ InterstitialHTMLSource() = default;
+ ~InterstitialHTMLSource() override = default;
// content::URLDataSource:
std::string GetMimeType(const std::string& mime_type) const override;
@@ -82,7 +82,7 @@ class InterstitialHTMLSource : public content::URLDataSource {
const content::URLDataSource::GotDataCallback& callback) override;
private:
- Profile* profile_;
+ std::string GetSupervisedUserInterstitialHTML(const std::string& path);
DISALLOW_COPY_AND_ASSIGN(InterstitialHTMLSource);
};
@@ -312,7 +312,7 @@ CaptivePortalBlockingPage* CreateCaptivePortalBlockingPage(
InterstitialUI::InterstitialUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
- content::URLDataSource::Add(profile, new InterstitialHTMLSource(profile));
+ content::URLDataSource::Add(profile, new InterstitialHTMLSource());
}
InterstitialUI::~InterstitialUI() {
@@ -370,10 +370,7 @@ void InterstitialHTMLSource::StartDataRequest(
#endif
std::string html;
if (base::StartsWith(path, "supervised_user", base::CompareCase::SENSITIVE)) {
- html = SupervisedUserInterstitial::GetHTMLContents(
- profile_, profile_->IsChild()
- ? supervised_user_error_page::ASYNC_CHECKER
- : supervised_user_error_page::MANUAL);
+ html = GetSupervisedUserInterstitialHTML(path);
} else if (interstitial_delegate.get()) {
html = interstitial_delegate.get()->GetHTMLContents();
} else {
@@ -385,3 +382,54 @@ void InterstitialHTMLSource::StartDataRequest(
html_bytes->data().assign(html.begin(), html.end());
callback.Run(html_bytes.get());
}
+
+std::string InterstitialHTMLSource::GetSupervisedUserInterstitialHTML(
+ const std::string& path) {
+ GURL url("https://localhost/" + path);
+
+ bool allow_access_requests = true;
+ std::string allow_access_requests_string;
+ if (net::GetValueForKeyInQuery(url, "allow_access_requests",
+ &allow_access_requests_string)) {
+ allow_access_requests = allow_access_requests_string == "0";
+ }
+
+ bool is_child_account = false;
+ std::string is_child_account_string;
+ if (net::GetValueForKeyInQuery(url, "is_child_account",
+ &is_child_account_string)) {
+ is_child_account = is_child_account_string == "1";
+ }
+
+ std::string custodian;
+ net::GetValueForKeyInQuery(url, "custodian", &custodian);
+ std::string second_custodian;
+ net::GetValueForKeyInQuery(url, "second_custodian", &second_custodian);
+ std::string custodian_email;
+ net::GetValueForKeyInQuery(url, "custodian_email", &custodian_email);
+ std::string second_custodian_email;
+ net::GetValueForKeyInQuery(url, "second_custodian_email",
+ &second_custodian_email);
+ std::string profile_image_url;
+ net::GetValueForKeyInQuery(url, "profile_image_url", &profile_image_url);
+ std::string profile_image_url2;
+ net::GetValueForKeyInQuery(url, "profile_image_url2", &profile_image_url2);
+
+ supervised_user_error_page::FilteringBehaviorReason reason =
+ supervised_user_error_page::DEFAULT;
+ std::string reason_string;
+ if (net::GetValueForKeyInQuery(url, "reason", &reason_string)) {
+ if (reason_string == "safe_sites") {
+ reason = supervised_user_error_page::BLACKLIST;
+ } else if (reason_string == "manual") {
+ reason = supervised_user_error_page::MANUAL;
+ } else if (reason_string == "not_signed_in") {
+ reason = supervised_user_error_page::NOT_SIGNED_IN;
+ }
+ }
+
+ return supervised_user_error_page::BuildHtml(
+ allow_access_requests, profile_image_url, profile_image_url2, custodian,
+ custodian_email, second_custodian, second_custodian_email,
+ is_child_account, reason, g_browser_process->GetApplicationLocale());
+}
« no previous file with comments | « no previous file | components/security_interstitials/core/browser/resources/interstitial_ui.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698