Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: chrome/browser/safe_browsing/protocol_parser.cc

Issue 1410343012: Revert of Move more declarations from c/b/sb/sb_util.h to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_components
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 *cache_lifetime = base::TimeDelta::FromSeconds(cache_lifetime_seconds); 193 *cache_lifetime = base::TimeDelta::FromSeconds(cache_lifetime_seconds);
194 } 194 }
195 195
196 while (!reader.empty()) { 196 while (!reader.empty()) {
197 std::vector<base::StringPiece> cmd_parts; 197 std::vector<base::StringPiece> cmd_parts;
198 if (!reader.GetPieces(3, &cmd_parts)) 198 if (!reader.GetPieces(3, &cmd_parts))
199 return false; 199 return false;
200 200
201 SBFullHashResult full_hash; 201 SBFullHashResult full_hash;
202 full_hash.list_id = safe_browsing::GetListId(cmd_parts[0]); 202 full_hash.list_id = safe_browsing_util::GetListId(cmd_parts[0]);
203 203
204 size_t hash_len; 204 size_t hash_len;
205 if (!base::StringToSizeT(cmd_parts[1], &hash_len)) 205 if (!base::StringToSizeT(cmd_parts[1], &hash_len))
206 return false; 206 return false;
207 207
208 // TODO(shess): Is this possible? If not, why the length present? 208 // TODO(shess): Is this possible? If not, why the length present?
209 if (hash_len != sizeof(SBFullHash)) 209 if (hash_len != sizeof(SBFullHash))
210 return false; 210 return false;
211 211
212 // Metadata is indicated by an optional ":m" at the end of the line. 212 // Metadata is indicated by an optional ":m" at the end of the line.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (!list.adds.empty() && !list.subs.empty()) 387 if (!list.adds.empty() && !list.subs.empty())
388 formatted_results.append(":"); 388 formatted_results.append(":");
389 if (!list.subs.empty()) 389 if (!list.subs.empty())
390 formatted_results.append("s:").append(list.subs); 390 formatted_results.append("s:").append(list.subs);
391 formatted_results.append("\n"); 391 formatted_results.append("\n");
392 392
393 return formatted_results; 393 return formatted_results;
394 } 394 }
395 395
396 } // namespace safe_browsing 396 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager_unittest.cc ('k') | chrome/browser/safe_browsing/protocol_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698