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

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 418293003: Revert of Add a chrome://interstitials page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ssl/ssl_blocking_page.h" 5 #include "chrome/browser/ssl/ssl_blocking_page.h"
6 6
7 #include "base/build_time.h" 7 #include "base/build_time.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 355 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
356 CaptivePortalService* captive_portal_service = 356 CaptivePortalService* captive_portal_service =
357 CaptivePortalServiceFactory::GetForProfile(profile); 357 CaptivePortalServiceFactory::GetForProfile(profile);
358 captive_portal_detection_enabled_ = captive_portal_service ->enabled(); 358 captive_portal_detection_enabled_ = captive_portal_service ->enabled();
359 captive_portal_service ->DetectCaptivePortal(); 359 captive_portal_service ->DetectCaptivePortal();
360 registrar_.Add(this, 360 registrar_.Add(this,
361 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, 361 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT,
362 content::Source<Profile>(profile)); 362 content::Source<Profile>(profile));
363 #endif 363 #endif
364 364
365 // chrome://interstitials page uses this class without actually creating an
366 // interstitial so that it can be debugged. Set |create_interstitial| to true
367 // if the page is going to be used as an actual interstitial and not just part
368 // of the chrome://interstitials webui.
369 interstitial_page_ = InterstitialPage::Create( 365 interstitial_page_ = InterstitialPage::Create(
370 web_contents_, true, request_url, this); 366 web_contents_, true, request_url, this);
367 interstitial_page_->Show();
371 } 368 }
372 369
373 SSLBlockingPage::~SSLBlockingPage() { 370 SSLBlockingPage::~SSLBlockingPage() {
374 if (!callback_.is_null()) { 371 if (!callback_.is_null()) {
375 RecordSSLBlockingPageDetailedStats(false, 372 RecordSSLBlockingPageDetailedStats(false,
376 cert_error_, 373 cert_error_,
377 overridable_ && !strict_enforcement_, 374 overridable_ && !strict_enforcement_,
378 internal_, 375 internal_,
379 num_visits_, 376 num_visits_,
380 captive_portal_detection_enabled_, 377 captive_portal_detection_enabled_,
381 captive_portal_probe_completed_, 378 captive_portal_probe_completed_,
382 captive_portal_no_response_, 379 captive_portal_no_response_,
383 captive_portal_detected_); 380 captive_portal_detected_);
384 // The page is closed without the user having chosen what to do, default to 381 // The page is closed without the user having chosen what to do, default to
385 // deny. 382 // deny.
386 NotifyDenyCertificate(); 383 NotifyDenyCertificate();
387 } 384 }
388 } 385 }
389 386
390 // static
391 void SSLBlockingPage::Show(content::WebContents* web_contents,
392 int cert_error,
393 const net::SSLInfo& ssl_info,
394 const GURL& request_url,
395 bool overridable,
396 bool strict_enforcement,
397 const base::Callback<void(bool)>& callback) {
398 SSLBlockingPage* ssl_blocking_page = new SSLBlockingPage(web_contents,
399 cert_error,
400 ssl_info,
401 request_url,
402 overridable,
403 strict_enforcement,
404 callback);
405 ssl_blocking_page->interstitial_page_->Show();
406 }
407
408 // static
409 SSLBlockingPage* SSLBlockingPage::CreateForWebUI(
410 content::WebContents* web_contents,
411 int cert_error,
412 const net::SSLInfo& ssl_info,
413 const GURL& request_url,
414 bool overridable,
415 bool strict_enforcement) {
416 return new SSLBlockingPage(web_contents,
417 cert_error,
418 ssl_info,
419 request_url,
420 overridable,
421 strict_enforcement,
422 base::Callback<void(bool)>());
423 }
424
425 std::string SSLBlockingPage::GetHTMLContents() { 387 std::string SSLBlockingPage::GetHTMLContents() {
426 if (trial_condition_ == kCondV1 || trial_condition_ == kCondV1LayoutV2Text) 388 if (trial_condition_ == kCondV1 || trial_condition_ == kCondV1LayoutV2Text)
427 return GetHTMLContentsV1(); 389 return GetHTMLContentsV1();
428 return GetHTMLContentsV2(); 390 return GetHTMLContentsV2();
429 } 391 }
430 392
431 std::string SSLBlockingPage::GetHTMLContentsV1() { 393 std::string SSLBlockingPage::GetHTMLContentsV1() {
432 base::DictionaryValue strings; 394 base::DictionaryValue strings;
433 int resource_id; 395 int resource_id;
434 if (overridable_ && !strict_enforcement_) { 396 if (overridable_ && !strict_enforcement_) {
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // sure we don't clear the captive portal flag, since the interstitial was 811 // sure we don't clear the captive portal flag, since the interstitial was
850 // potentially caused by the captive portal. 812 // potentially caused by the captive portal.
851 captive_portal_detected_ = captive_portal_detected_ || 813 captive_portal_detected_ = captive_portal_detected_ ||
852 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); 814 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
853 // Also keep track of non-HTTP portals and error cases. 815 // Also keep track of non-HTTP portals and error cases.
854 captive_portal_no_response_ = captive_portal_no_response_ || 816 captive_portal_no_response_ = captive_portal_no_response_ ||
855 (results->result == captive_portal::RESULT_NO_RESPONSE); 817 (results->result == captive_portal::RESULT_NO_RESPONSE);
856 } 818 }
857 #endif 819 #endif
858 } 820 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.h ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698