| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/safe_browsing_api_handler_util.h" | 5 #include "components/safe_browsing_db/safe_browsing_api_handler_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/safe_browsing/metadata.pb.h" | 16 #include "components/safe_browsing_db/metadata.pb.h" |
| 17 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 17 #include "components/safe_browsing_db/util.h" |
| 18 | 18 |
| 19 | 19 |
| 20 namespace safe_browsing { | 20 namespace safe_browsing { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // JSON metatdata keys. These are are fixed in the Java-side API. | 23 // JSON metatdata keys. These are are fixed in the Java-side API. |
| 24 const char kJsonKeyMatches[] = "matches"; | 24 const char kJsonKeyMatches[] = "matches"; |
| 25 const char kJsonKeyThreatType[] = "threat_type"; | 25 const char kJsonKeyThreatType[] = "threat_type"; |
| 26 | 26 |
| 27 // Do not reorder or delete. Make sure changes are reflected in | 27 // Do not reorder or delete. Make sure changes are reflected in |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 *worst_threat = JavaToSBThreatType(worst_threat_num); | 159 *worst_threat = JavaToSBThreatType(worst_threat_num); |
| 160 if (*worst_threat == SB_THREAT_TYPE_SAFE || !worst_match) | 160 if (*worst_threat == SB_THREAT_TYPE_SAFE || !worst_match) |
| 161 return UMA_STATUS_JSON_UNKNOWN_THREAT; | 161 return UMA_STATUS_JSON_UNKNOWN_THREAT; |
| 162 *metadata_pb_str = ParseExtraMetadataToPB(worst_match, *worst_threat); | 162 *metadata_pb_str = ParseExtraMetadataToPB(worst_match, *worst_threat); |
| 163 | 163 |
| 164 return UMA_STATUS_UNSAFE; // success | 164 return UMA_STATUS_UNSAFE; // success |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace safe_browsing | 167 } // namespace safe_browsing |
| OLD | NEW |