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 12 matching lines...) Expand all Loading... |
23 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
24 | 24 |
25 using base::Time; | 25 using base::Time; |
26 using base::TimeDelta; | 26 using base::TimeDelta; |
27 | 27 |
28 // Maximum time, in seconds, from start up before we must issue an update query. | 28 // Maximum time, in seconds, from start up before we must issue an update query. |
29 static const int kSbTimerStartIntervalSec = 5 * 60; | 29 static const int kSbTimerStartIntervalSec = 5 * 60; |
30 | 30 |
31 // Update URL for querying about the latest set of chunk updates. | 31 // Update URL for querying about the latest set of chunk updates. |
32 static const char* const kSbUpdateUrl = | 32 static const char* const kSbUpdateUrl = |
33 "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s&app
ver=%s&pver=2.2"; | 33 "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s" |
| 34 "&appver=%s&pver=2.2"; |
34 | 35 |
35 // GetHash request URL for retrieving full hashes. | 36 // GetHash request URL for retrieving full hashes. |
36 static const char* const kSbGetHashUrl = | 37 static const char* const kSbGetHashUrl = |
37 "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=%s&appve
r=%s&pver=2.2"; | 38 "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=%s" |
| 39 "&appver=%s&pver=2.2"; |
38 | 40 |
39 // New MAC client key requests URL. | 41 // New MAC client key requests URL. |
40 static const char* const kSbNewKeyUrl = | 42 static const char* const kSbNewKeyUrl = |
41 "https://sb-ssl.google.com/safebrowsing/newkey?client=%s&appver=%s&pver=2.2"
; | 43 "https://sb-ssl.google.com/safebrowsing/newkey?client=%s&appver=%s" |
| 44 "&pver=2.2"; |
42 | 45 |
43 // URL for reporting malware pages. | 46 // URL for reporting malware pages. |
44 static const char* const kSbMalwareReportUrl = | 47 static const char* const kSbMalwareReportUrl = |
45 "http://safebrowsing.clients.google.com/safebrowsing/report?evts=malblhit&ev
td=%s&evtr=%s&evhr=%s&client=%s&appver=%s"; | 48 "http://safebrowsing.clients.google.com/safebrowsing/report?evts=malblhit" |
| 49 "&evtd=%s&evtr=%s&evhr=%s&client=%s&appver=%s"; |
46 | 50 |
47 #if defined(GOOGLE_CHROME_BUILD) | 51 #if defined(GOOGLE_CHROME_BUILD) |
48 static const char* const kSbClientName = "googlechrome"; | 52 static const char* const kSbClientName = "googlechrome"; |
49 #else | 53 #else |
50 static const char* const kSbClientName = "chromium"; | 54 static const char* const kSbClientName = "chromium"; |
51 #endif | 55 #endif |
52 | 56 |
53 // Maximum back off multiplier. | 57 // Maximum back off multiplier. |
54 static const int kSbMaxBackOff = 8; | 58 static const int kSbMaxBackOff = 8; |
55 | 59 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 void SafeBrowsingProtocolManager::HandleGetHashError() { | 628 void SafeBrowsingProtocolManager::HandleGetHashError() { |
625 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); | 629 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); |
626 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); | 630 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); |
627 } | 631 } |
628 | 632 |
629 void SafeBrowsingProtocolManager::UpdateFinished(bool success) { | 633 void SafeBrowsingProtocolManager::UpdateFinished(bool success) { |
630 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_); | 634 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_); |
631 update_size_ = 0; | 635 update_size_ = 0; |
632 sb_service_->UpdateFinished(success); | 636 sb_service_->UpdateFinished(success); |
633 } | 637 } |
OLD | NEW |