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/safe_browsing/protocol_manager.h" | 5 #include "chrome/browser/safe_browsing/protocol_manager.h" |
6 | 6 |
7 #include "base/environment.h" | 7 #include "base/environment.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/profiler/scoped_profile.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "chrome/browser/safe_browsing/protocol_parser.h" | 17 #include "chrome/browser/safe_browsing/protocol_parser.h" |
18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
19 #include "chrome/common/env_vars.h" | 19 #include "chrome/common/env_vars.h" |
20 #include "google_apis/google_api_keys.h" | 20 #include "google_apis/google_api_keys.h" |
21 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // All SafeBrowsing request responses are handled here. | 220 // All SafeBrowsing request responses are handled here. |
221 // TODO(paulg): Clarify with the SafeBrowsing team whether a failed parse of a | 221 // TODO(paulg): Clarify with the SafeBrowsing team whether a failed parse of a |
222 // chunk should retry the download and parse of that chunk (and | 222 // chunk should retry the download and parse of that chunk (and |
223 // what back off / how many times to try), and if that effects the | 223 // what back off / how many times to try), and if that effects the |
224 // update back off. For now, a failed parse of the chunk means we | 224 // update back off. For now, a failed parse of the chunk means we |
225 // drop it. This isn't so bad because the next UPDATE_REQUEST we | 225 // drop it. This isn't so bad because the next UPDATE_REQUEST we |
226 // do will report all the chunks we have. If that chunk is still | 226 // do will report all the chunks we have. If that chunk is still |
227 // required, the SafeBrowsing servers will tell us to get it again. | 227 // required, the SafeBrowsing servers will tell us to get it again. |
228 void SafeBrowsingProtocolManager::OnURLFetchComplete( | 228 void SafeBrowsingProtocolManager::OnURLFetchComplete( |
229 const net::URLFetcher* source) { | 229 const net::URLFetcher* source) { |
230 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. | 230 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. |
231 tracked_objects::ScopedProfile tracking_profile( | 231 tracked_objects::ScopedTracker tracking_profile( |
232 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 232 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
233 "422577 SafeBrowsingProtocolManager::OnURLFetchComplete")); | 233 "422577 SafeBrowsingProtocolManager::OnURLFetchComplete")); |
234 | 234 |
235 DCHECK(CalledOnValidThread()); | 235 DCHECK(CalledOnValidThread()); |
236 scoped_ptr<const net::URLFetcher> fetcher; | 236 scoped_ptr<const net::URLFetcher> fetcher; |
237 | 237 |
238 HashRequests::iterator it = hash_requests_.find(source); | 238 HashRequests::iterator it = hash_requests_.find(source); |
239 if (it != hash_requests_.end()) { | 239 if (it != hash_requests_.end()) { |
240 // GetHash response. | 240 // GetHash response. |
241 fetcher.reset(it->first); | 241 fetcher.reset(it->first); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 FullHashCallback callback, bool is_download) | 776 FullHashCallback callback, bool is_download) |
777 : callback(callback), | 777 : callback(callback), |
778 is_download(is_download) { | 778 is_download(is_download) { |
779 } | 779 } |
780 | 780 |
781 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() { | 781 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() { |
782 } | 782 } |
783 | 783 |
784 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() { | 784 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() { |
785 } | 785 } |
OLD | NEW |