OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 // Schedule the next model reload. | 272 // Schedule the next model reload. |
273 ScheduleFetchModel(delay_ms); | 273 ScheduleFetchModel(delay_ms); |
274 } | 274 } |
275 | 275 |
276 void ClientSideDetectionService::SanitizeRequestForPingback( | 276 void ClientSideDetectionService::SanitizeRequestForPingback( |
277 const ClientPhishingRequest& full_request, | 277 const ClientPhishingRequest& full_request, |
278 ClientPhishingRequest* sanitized_request) { | 278 ClientPhishingRequest* sanitized_request) { |
279 DCHECK(full_request.IsInitialized()); | 279 DCHECK(full_request.IsInitialized()); |
280 sanitized_request->Clear(); | 280 sanitized_request->Clear(); |
281 if (full_request.has_suffix_prefix_hash()) { | 281 if (full_request.has_hash_prefix()) { |
282 sanitized_request->set_suffix_prefix_hash( | 282 sanitized_request->set_hash_prefix(full_request.hash_prefix()); |
283 full_request.suffix_prefix_hash()); | |
284 } | 283 } |
285 sanitized_request->set_client_score(full_request.client_score()); | 284 sanitized_request->set_client_score(full_request.client_score()); |
286 if (full_request.has_is_phishing()) { | 285 if (full_request.has_is_phishing()) { |
287 sanitized_request->set_is_phishing(full_request.is_phishing()); | 286 sanitized_request->set_is_phishing(full_request.is_phishing()); |
288 } | 287 } |
289 | 288 |
290 for (int i = 0; i < full_request.feature_map_size(); ++i) { | 289 for (int i = 0; i < full_request.feature_map_size(); ++i) { |
291 const ClientPhishingRequest_Feature& feature = full_request.feature_map(i); | 290 const ClientPhishingRequest_Feature& feature = full_request.feature_map(i); |
292 if (allowed_features_.find(feature.name()) != allowed_features_.end()) { | 291 if (allowed_features_.find(feature.name()) != allowed_features_.end()) { |
293 sanitized_request->add_feature_map()->CopyFrom(feature); | 292 sanitized_request->add_feature_map()->CopyFrom(feature); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 } | 601 } |
603 } | 602 } |
604 for (int i = 0; i < model.page_word_size(); ++i) { | 603 for (int i = 0; i < model.page_word_size(); ++i) { |
605 if (model.page_word(i) < 0 || model.page_word(i) > max_index) { | 604 if (model.page_word(i) < 0 || model.page_word(i) > max_index) { |
606 return false; | 605 return false; |
607 } | 606 } |
608 } | 607 } |
609 return true; | 608 return true; |
610 } | 609 } |
611 } // namespace safe_browsing | 610 } // namespace safe_browsing |
OLD | NEW |