| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 GURL phishing_url; | 63 GURL phishing_url; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 ClientSideDetectionService::CacheState::CacheState(bool phish, base::Time time) | 66 ClientSideDetectionService::CacheState::CacheState(bool phish, base::Time time) |
| 67 : is_phishing(phish), | 67 : is_phishing(phish), |
| 68 timestamp(time) {} | 68 timestamp(time) {} |
| 69 | 69 |
| 70 ClientSideDetectionService::ClientSideDetectionService( | 70 ClientSideDetectionService::ClientSideDetectionService( |
| 71 net::URLRequestContextGetter* request_context_getter) | 71 net::URLRequestContextGetter* request_context_getter) |
| 72 : enabled_(false), | 72 : enabled_(false), |
| 73 malware_enabled_(false), |
| 73 weak_factory_(this), | 74 weak_factory_(this), |
| 74 request_context_getter_(request_context_getter) { | 75 request_context_getter_(request_context_getter) { |
| 75 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 76 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 76 content::NotificationService::AllBrowserContextsAndSources()); | 77 content::NotificationService::AllBrowserContextsAndSources()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 ClientSideDetectionService::~ClientSideDetectionService() { | 80 ClientSideDetectionService::~ClientSideDetectionService() { |
| 80 weak_factory_.InvalidateWeakPtrs(); | 81 weak_factory_.InvalidateWeakPtrs(); |
| 81 STLDeleteContainerPairPointers(client_phishing_reports_.begin(), | 82 STLDeleteContainerPairPointers(client_phishing_reports_.begin(), |
| 82 client_phishing_reports_.end()); | 83 client_phishing_reports_.end()); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 const std::string& report_url) { | 639 const std::string& report_url) { |
| 639 std::string url = report_url; | 640 std::string url = report_url; |
| 640 std::string api_key = google_apis::GetAPIKey(); | 641 std::string api_key = google_apis::GetAPIKey(); |
| 641 if (!api_key.empty()) { | 642 if (!api_key.empty()) { |
| 642 base::StringAppendF(&url, "?key=%s", | 643 base::StringAppendF(&url, "?key=%s", |
| 643 net::EscapeQueryParamValue(api_key, true).c_str()); | 644 net::EscapeQueryParamValue(api_key, true).c_str()); |
| 644 } | 645 } |
| 645 return url; | 646 return url; |
| 646 } | 647 } |
| 647 } // namespace safe_browsing | 648 } // namespace safe_browsing |
| OLD | NEW |