| OLD | NEW |
| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 RecordSSLBlockingPageEventStats(SHOW_ALL); | 288 RecordSSLBlockingPageEventStats(SHOW_ALL); |
| 289 if (overridable_ && !strict_enforcement_) { | 289 if (overridable_ && !strict_enforcement_) { |
| 290 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE); | 290 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE); |
| 291 if (internal_) | 291 if (internal_) |
| 292 RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); | 292 RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); |
| 293 HistoryService* history_service = HistoryServiceFactory::GetForProfile( | 293 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 294 profile, Profile::EXPLICIT_ACCESS); | 294 profile, Profile::EXPLICIT_ACCESS); |
| 295 if (history_service) { | 295 if (history_service) { |
| 296 history_service->GetVisibleVisitCountToHost( | 296 history_service->GetVisibleVisitCountToHost( |
| 297 request_url_, | 297 request_url_, |
| 298 &request_consumer_, | |
| 299 base::Bind(&SSLBlockingPage::OnGotHistoryCount, | 298 base::Bind(&SSLBlockingPage::OnGotHistoryCount, |
| 300 base::Unretained(this))); | 299 base::Unretained(this)), |
| 300 &request_tracker_); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 304 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 305 CaptivePortalService* captive_portal_service = | 305 CaptivePortalService* captive_portal_service = |
| 306 CaptivePortalServiceFactory::GetForProfile(profile); | 306 CaptivePortalServiceFactory::GetForProfile(profile); |
| 307 captive_portal_detection_enabled_ = captive_portal_service ->enabled(); | 307 captive_portal_detection_enabled_ = captive_portal_service ->enabled(); |
| 308 captive_portal_service ->DetectCaptivePortal(); | 308 captive_portal_service ->DetectCaptivePortal(); |
| 309 registrar_.Add(this, | 309 registrar_.Add(this, |
| 310 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, | 310 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 }; | 715 }; |
| 716 int i; | 716 int i; |
| 717 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 717 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 718 strings->SetString(keys[i], extra_info[i]); | 718 strings->SetString(keys[i], extra_info[i]); |
| 719 } | 719 } |
| 720 for (; i < 5; i++) { | 720 for (; i < 5; i++) { |
| 721 strings->SetString(keys[i], std::string()); | 721 strings->SetString(keys[i], std::string()); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 | 724 |
| 725 void SSLBlockingPage::OnGotHistoryCount(HistoryService::Handle handle, | 725 void SSLBlockingPage::OnGotHistoryCount(bool success, |
| 726 bool success, | |
| 727 int num_visits, | 726 int num_visits, |
| 728 base::Time first_visit) { | 727 base::Time first_visit) { |
| 729 num_visits_ = num_visits; | 728 num_visits_ = num_visits; |
| 730 } | 729 } |
| 731 | 730 |
| 732 void SSLBlockingPage::Observe( | 731 void SSLBlockingPage::Observe( |
| 733 int type, | 732 int type, |
| 734 const content::NotificationSource& source, | 733 const content::NotificationSource& source, |
| 735 const content::NotificationDetails& details) { | 734 const content::NotificationDetails& details) { |
| 736 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 735 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 753 // sure we don't clear the captive portal flag, since the interstitial was | 752 // sure we don't clear the captive portal flag, since the interstitial was |
| 754 // potentially caused by the captive portal. | 753 // potentially caused by the captive portal. |
| 755 captive_portal_detected_ = captive_portal_detected_ || | 754 captive_portal_detected_ = captive_portal_detected_ || |
| 756 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 755 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
| 757 // Also keep track of non-HTTP portals and error cases. | 756 // Also keep track of non-HTTP portals and error cases. |
| 758 captive_portal_no_response_ = captive_portal_no_response_ || | 757 captive_portal_no_response_ = captive_portal_no_response_ || |
| 759 (results->result == captive_portal::RESULT_NO_RESPONSE); | 758 (results->result == captive_portal::RESULT_NO_RESPONSE); |
| 760 } | 759 } |
| 761 #endif | 760 #endif |
| 762 } | 761 } |
| OLD | NEW |