| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NDEBUG | 7 #ifndef NDEBUG |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #endif | 9 #endif |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 https_url_prefix_(https_url_prefix), | 112 https_url_prefix_(https_url_prefix), |
| 113 disable_auto_update_(disable_auto_update) { | 113 disable_auto_update_(disable_auto_update) { |
| 114 DCHECK(!http_url_prefix_.empty() && !https_url_prefix_.empty()); | 114 DCHECK(!http_url_prefix_.empty() && !https_url_prefix_.empty()); |
| 115 | 115 |
| 116 // Set the backoff multiplier fuzz to a random value between 0 and 1. | 116 // Set the backoff multiplier fuzz to a random value between 0 and 1. |
| 117 back_off_fuzz_ = static_cast<float>(base::RandDouble()); | 117 back_off_fuzz_ = static_cast<float>(base::RandDouble()); |
| 118 // The first update must happen between 1-5 minutes of start up. | 118 // The first update must happen between 1-5 minutes of start up. |
| 119 next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); | 119 next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); |
| 120 | 120 |
| 121 chrome::VersionInfo version_info; | 121 chrome::VersionInfo version_info; |
| 122 if (!version_info.is_valid() || version_info.Version().empty()) | 122 version_ = version_info.Version(); |
| 123 version_ = "0.1"; | |
| 124 else | |
| 125 version_ = version_info.Version(); | |
| 126 } | 123 } |
| 127 | 124 |
| 128 SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { | 125 SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { |
| 129 // Delete in-progress SafeBrowsing requests. | 126 // Delete in-progress SafeBrowsing requests. |
| 130 STLDeleteContainerPairFirstPointers(hash_requests_.begin(), | 127 STLDeleteContainerPairFirstPointers(hash_requests_.begin(), |
| 131 hash_requests_.end()); | 128 hash_requests_.end()); |
| 132 hash_requests_.clear(); | 129 hash_requests_.clear(); |
| 133 | 130 |
| 134 // Delete in-progress safebrowsing reports (hits and details). | 131 // Delete in-progress safebrowsing reports (hits and details). |
| 135 STLDeleteContainerPointers(safebrowsing_reports_.begin(), | 132 STLDeleteContainerPointers(safebrowsing_reports_.begin(), |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 if (!additional_query_.empty()) { | 783 if (!additional_query_.empty()) { |
| 787 if (next_url.find("?") != std::string::npos) { | 784 if (next_url.find("?") != std::string::npos) { |
| 788 next_url.append("&"); | 785 next_url.append("&"); |
| 789 } else { | 786 } else { |
| 790 next_url.append("?"); | 787 next_url.append("?"); |
| 791 } | 788 } |
| 792 next_url.append(additional_query_); | 789 next_url.append(additional_query_); |
| 793 } | 790 } |
| 794 return GURL(next_url); | 791 return GURL(next_url); |
| 795 } | 792 } |
| OLD | NEW |