| 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/client_side_detection_service.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 GURL original_url; | 93 GURL original_url; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 ClientSideDetectionService::CacheState::CacheState(bool phish, base::Time time) | 96 ClientSideDetectionService::CacheState::CacheState(bool phish, base::Time time) |
| 97 : is_phishing(phish), | 97 : is_phishing(phish), |
| 98 timestamp(time) {} | 98 timestamp(time) {} |
| 99 | 99 |
| 100 ClientSideDetectionService::ClientSideDetectionService( | 100 ClientSideDetectionService::ClientSideDetectionService( |
| 101 net::URLRequestContextGetter* request_context_getter) | 101 net::URLRequestContextGetter* request_context_getter) |
| 102 : enabled_(false), | 102 : enabled_(false), |
| 103 weak_factory_(this), | 103 request_context_getter_(request_context_getter), |
| 104 request_context_getter_(request_context_getter) { | 104 weak_factory_(this) { |
| 105 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 105 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 106 content::NotificationService::AllBrowserContextsAndSources()); | 106 content::NotificationService::AllBrowserContextsAndSources()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 ClientSideDetectionService::~ClientSideDetectionService() { | 109 ClientSideDetectionService::~ClientSideDetectionService() { |
| 110 weak_factory_.InvalidateWeakPtrs(); | 110 weak_factory_.InvalidateWeakPtrs(); |
| 111 STLDeleteContainerPairPointers(client_phishing_reports_.begin(), | 111 STLDeleteContainerPairPointers(client_phishing_reports_.begin(), |
| 112 client_phishing_reports_.end()); | 112 client_phishing_reports_.end()); |
| 113 client_phishing_reports_.clear(); | 113 client_phishing_reports_.clear(); |
| 114 STLDeleteContainerPairPointers(client_malware_reports_.begin(), | 114 STLDeleteContainerPairPointers(client_malware_reports_.begin(), |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 GURL ClientSideDetectionService::GetClientReportUrl( | 635 GURL ClientSideDetectionService::GetClientReportUrl( |
| 636 const std::string& report_url) { | 636 const std::string& report_url) { |
| 637 GURL url(report_url); | 637 GURL url(report_url); |
| 638 std::string api_key = google_apis::GetAPIKey(); | 638 std::string api_key = google_apis::GetAPIKey(); |
| 639 if (!api_key.empty()) | 639 if (!api_key.empty()) |
| 640 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 640 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
| 641 | 641 |
| 642 return url; | 642 return url; |
| 643 } | 643 } |
| 644 } // namespace safe_browsing | 644 } // namespace safe_browsing |
| OLD | NEW |