Chromium Code Reviews| 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/renderer_host/safe_browsing_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prerender/prerender_contents.h" | 9 #include "chrome/browser/prerender/prerender_contents.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 | 79 |
| 80 // SafeBrowsingService::Client implementation, called on the IO thread once | 80 // SafeBrowsingService::Client implementation, called on the IO thread once |
| 81 // the URL has been classified. | 81 // the URL has been classified. |
| 82 void SafeBrowsingResourceThrottle::OnCheckBrowseUrlResult( | 82 void SafeBrowsingResourceThrottle::OnCheckBrowseUrlResult( |
| 83 const GURL& url, SBThreatType threat_type) { | 83 const GURL& url, SBThreatType threat_type) { |
| 84 CHECK(state_ == STATE_CHECKING_URL); | 84 CHECK(state_ == STATE_CHECKING_URL); |
| 85 CHECK(defer_state_ != DEFERRED_NONE); | 85 CHECK(defer_state_ != DEFERRED_NONE); |
| 86 CHECK(url == url_being_checked_) << "Was expecting: " << url_being_checked_ | 86 CHECK(url == url_being_checked_) << "Was expecting: " << url_being_checked_ |
| 87 << " but got: " << url; | 87 << " but got: " << url; |
| 88 | 88 |
| 89 #if defined(OS_ANDROID) | |
| 90 // Temporarily disable SB interstitial during Finch experiment. | |
|
sky
2014/07/31 17:34:06
If this is only for a finch experiment, shouldn't
| |
| 91 // The database check is still exercised, but the interstitial never shown. | |
| 92 threat_type = SB_THREAT_TYPE_SAFE; | |
| 93 #endif | |
| 94 | |
| 89 timer_.Stop(); // Cancel the timeout timer. | 95 timer_.Stop(); // Cancel the timeout timer. |
| 90 threat_type_ = threat_type; | 96 threat_type_ = threat_type; |
| 91 state_ = STATE_NONE; | 97 state_ = STATE_NONE; |
| 92 | 98 |
| 93 if (threat_type == SB_THREAT_TYPE_SAFE) { | 99 if (threat_type == SB_THREAT_TYPE_SAFE) { |
| 94 // Log how much time the safe browsing check cost us. | 100 // Log how much time the safe browsing check cost us. |
| 95 ui_manager_->LogPauseDelay(base::TimeTicks::Now() - url_check_start_time_); | 101 ui_manager_->LogPauseDelay(base::TimeTicks::Now() - url_check_start_time_); |
| 96 | 102 |
| 97 // Continue the request. | 103 // Continue the request. |
| 98 ResumeRequest(); | 104 ResumeRequest(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 OnCheckBrowseUrlResult(url_being_checked_, SB_THREAT_TYPE_SAFE); | 216 OnCheckBrowseUrlResult(url_being_checked_, SB_THREAT_TYPE_SAFE); |
| 211 } | 217 } |
| 212 | 218 |
| 213 void SafeBrowsingResourceThrottle::ResumeRequest() { | 219 void SafeBrowsingResourceThrottle::ResumeRequest() { |
| 214 CHECK(state_ == STATE_NONE); | 220 CHECK(state_ == STATE_NONE); |
| 215 CHECK(defer_state_ != DEFERRED_NONE); | 221 CHECK(defer_state_ != DEFERRED_NONE); |
| 216 | 222 |
| 217 defer_state_ = DEFERRED_NONE; | 223 defer_state_ = DEFERRED_NONE; |
| 218 controller()->Resume(); | 224 controller()->Resume(); |
| 219 } | 225 } |
| OLD | NEW |