| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/safe_browsing/protocol_manager.h" | 5 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 6 | 6 |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 HashRequests::iterator it = hash_requests_.find(source); | 191 HashRequests::iterator it = hash_requests_.find(source); |
| 192 if (it != hash_requests_.end()) { | 192 if (it != hash_requests_.end()) { |
| 193 // GetHash response. | 193 // GetHash response. |
| 194 fetcher.reset(it->first); | 194 fetcher.reset(it->first); |
| 195 SafeBrowsingService::SafeBrowsingCheck* check = it->second; | 195 SafeBrowsingService::SafeBrowsingCheck* check = it->second; |
| 196 std::vector<SBFullHashResult> full_hashes; | 196 std::vector<SBFullHashResult> full_hashes; |
| 197 bool can_cache = false; | 197 bool can_cache = false; |
| 198 if (response_code == 200 || response_code == 204) { | 198 if (response_code == 200 || response_code == 204) { |
| 199 // For tracking our GetHash false positive (204) rate, compared to real |
| 200 // (200) responses. |
| 201 if (response_code == 200) |
| 202 UMA_HISTOGRAM_COUNTS("SB2.GetHash200", 1); |
| 203 else |
| 204 UMA_HISTOGRAM_COUNTS("SB2.GetHash204", 1); |
| 199 can_cache = true; | 205 can_cache = true; |
| 200 gethash_error_count_ = 0; | 206 gethash_error_count_ = 0; |
| 201 gethash_back_off_mult_ = 1; | 207 gethash_back_off_mult_ = 1; |
| 202 bool re_key = false; | 208 bool re_key = false; |
| 203 SafeBrowsingProtocolParser parser; | 209 SafeBrowsingProtocolParser parser; |
| 204 parsed_ok = parser.ParseGetHash(data.data(), | 210 parsed_ok = parser.ParseGetHash(data.data(), |
| 205 static_cast<int>(data.length()), | 211 static_cast<int>(data.length()), |
| 206 client_key_, | 212 client_key_, |
| 207 &re_key, | 213 &re_key, |
| 208 &full_hashes); | 214 &full_hashes); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 void SafeBrowsingProtocolManager::HandleGetHashError() { | 629 void SafeBrowsingProtocolManager::HandleGetHashError() { |
| 624 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); | 630 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); |
| 625 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); | 631 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); |
| 626 } | 632 } |
| 627 | 633 |
| 628 void SafeBrowsingProtocolManager::UpdateFinished(bool success) { | 634 void SafeBrowsingProtocolManager::UpdateFinished(bool success) { |
| 629 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_); | 635 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_); |
| 630 update_size_ = 0; | 636 update_size_ = 0; |
| 631 sb_service_->UpdateFinished(success); | 637 sb_service_->UpdateFinished(success); |
| 632 } | 638 } |
| OLD | NEW |