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" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
17 #include "chrome/browser/safe_browsing/protocol_parser.h" | 17 #include "chrome/browser/safe_browsing/protocol_parser.h" |
18 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 18 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
19 #include "chrome/common/env_vars.h" | 19 #include "chrome/common/env_vars.h" |
20 #include "chrome/common/stl_util-inl.h" | 20 #include "chrome/common/stl_util-inl.h" |
21 #include "net/base/base64.h" | 21 #include "net/base/base64.h" |
22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
23 | 23 |
| 24 using base::Time; |
| 25 using base::TimeDelta; |
24 | 26 |
25 // Maximum time, in seconds, from start up before we must issue an update query. | 27 // Maximum time, in seconds, from start up before we must issue an update query. |
26 static const int kSbTimerStartIntervalSec = 5 * 60; | 28 static const int kSbTimerStartIntervalSec = 5 * 60; |
27 | 29 |
28 // Update URL for querying about the latest set of chunk updates. | 30 // Update URL for querying about the latest set of chunk updates. |
29 static const char* const kSbUpdateUrl = | 31 static const char* const kSbUpdateUrl = |
30 "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s&app
ver=%s&pver=2.1"; | 32 "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s&app
ver=%s&pver=2.1"; |
31 | 33 |
32 // GetHash request URL for retrieving full hashes. | 34 // GetHash request URL for retrieving full hashes. |
33 static const char* const kSbGetHashUrl = | 35 static const char* const kSbGetHashUrl = |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void SafeBrowsingProtocolManager::HandleReKey() { | 546 void SafeBrowsingProtocolManager::HandleReKey() { |
545 client_key_.clear(); | 547 client_key_.clear(); |
546 wrapped_key_.clear(); | 548 wrapped_key_.clear(); |
547 IssueKeyRequest(); | 549 IssueKeyRequest(); |
548 } | 550 } |
549 | 551 |
550 void SafeBrowsingProtocolManager::HandleGetHashError() { | 552 void SafeBrowsingProtocolManager::HandleGetHashError() { |
551 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); | 553 int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_); |
552 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); | 554 next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next); |
553 } | 555 } |
OLD | NEW |