| 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 // Parse the data returned from the SafeBrowsing v2.1 protocol response. | 5 // Parse the data returned from the SafeBrowsing v2.1 protocol response. |
| 6 | 6 |
| 7 // TODOv3(shess): Review these changes carefully. | 7 // TODOv3(shess): Review these changes carefully. |
| 8 | 8 |
| 9 #include "chrome/browser/safe_browsing/protocol_parser.h" | 9 #include "chrome/browser/safe_browsing/protocol_parser.h" |
| 10 | 10 |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 #include <stdlib.h> | 12 #include <stdlib.h> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/sys_byteorder.h" | 21 #include "base/sys_byteorder.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | |
| 25 #include "components/safe_browsing_db/metadata.pb.h" | 24 #include "components/safe_browsing_db/metadata.pb.h" |
| 26 | 25 |
| 27 namespace safe_browsing { | 26 namespace safe_browsing { |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 // Helper class for scanning a buffer. | 30 // Helper class for scanning a buffer. |
| 32 class BufferReader { | 31 class BufferReader { |
| 33 public: | 32 public: |
| 34 BufferReader(const char* data, size_t length) | 33 BufferReader(const char* data, size_t length) |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (!list.adds.empty() && !list.subs.empty()) | 430 if (!list.adds.empty() && !list.subs.empty()) |
| 432 formatted_results.append(":"); | 431 formatted_results.append(":"); |
| 433 if (!list.subs.empty()) | 432 if (!list.subs.empty()) |
| 434 formatted_results.append("s:").append(list.subs); | 433 formatted_results.append("s:").append(list.subs); |
| 435 formatted_results.append("\n"); | 434 formatted_results.append("\n"); |
| 436 | 435 |
| 437 return formatted_results; | 436 return formatted_results; |
| 438 } | 437 } |
| 439 | 438 |
| 440 } // namespace safe_browsing | 439 } // namespace safe_browsing |
| OLD | NEW |