| 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/client_side_detection_service.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
| 26 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 27 | 27 |
| 28 namespace safe_browsing { | 28 namespace safe_browsing { |
| 29 | 29 |
| 30 const char ClientSideDetectionService::kClientReportPhishingUrl[] = | 30 const char ClientSideDetectionService::kClientReportPhishingUrl[] = |
| 31 "https://sb-ssl.google.com/safebrowsing/clientreport/phishing"; | 31 "https://sb-ssl.google.com/safebrowsing/clientreport/phishing"; |
| 32 const char ClientSideDetectionService::kClientModelUrl[] = | 32 const char ClientSideDetectionService::kClientModelUrl[] = |
| 33 "https://ssl.gstatic.com/safebrowsing/csd/client_model_v0.pb"; | 33 "https://ssl.gstatic.com/safebrowsing/csd/client_model_v0.pb"; |
| 34 | 34 |
| 35 struct ClientSideDetectionService::ClientReportInfo { |
| 36 scoped_ptr<ClientReportPhishingRequestCallback> callback; |
| 37 GURL phishing_url; |
| 38 }; |
| 39 |
| 35 ClientSideDetectionService::ClientSideDetectionService( | 40 ClientSideDetectionService::ClientSideDetectionService( |
| 36 const FilePath& model_path, | 41 const FilePath& model_path, |
| 37 URLRequestContextGetter* request_context_getter) | 42 URLRequestContextGetter* request_context_getter) |
| 38 : model_path_(model_path), | 43 : model_path_(model_path), |
| 39 model_status_(UNKNOWN_STATUS), | 44 model_status_(UNKNOWN_STATUS), |
| 40 model_file_(base::kInvalidPlatformFileValue), | 45 model_file_(base::kInvalidPlatformFileValue), |
| 41 model_fetcher_(NULL), | 46 model_fetcher_(NULL), |
| 42 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 47 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
| 43 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), | 48 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), |
| 44 request_context_getter_(request_context_getter) { | 49 request_context_getter_(request_context_getter) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 info->callback->Run(info->phishing_url, response.phishy()); | 317 info->callback->Run(info->phishing_url, response.phishy()); |
| 313 } else { | 318 } else { |
| 314 DLOG(ERROR) << "Unable to get the server verdict for URL: " | 319 DLOG(ERROR) << "Unable to get the server verdict for URL: " |
| 315 << info->phishing_url; | 320 << info->phishing_url; |
| 316 info->callback->Run(info->phishing_url, false); | 321 info->callback->Run(info->phishing_url, false); |
| 317 } | 322 } |
| 318 client_phishing_reports_.erase(source); | 323 client_phishing_reports_.erase(source); |
| 319 } | 324 } |
| 320 | 325 |
| 321 } // namespace safe_browsing | 326 } // namespace safe_browsing |
| OLD | NEW |