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

Side by Side Diff: components/safe_browsing_db/v4_protocol_manager_util.cc

Issue 2830093003: Replace uses of hash_map in //base (Closed)
Patch Set: iOS Created 3 years, 8 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/safe_browsing_db/v4_protocol_manager_util.h" 5 #include "components/safe_browsing_db/v4_protocol_manager_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/hash.h"
8 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
9 #include "base/rand_util.h" 10 #include "base/rand_util.h"
10 #include "base/sha1.h" 11 #include "base/sha1.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "crypto/sha2.h" 14 #include "crypto/sha2.h"
14 #include "net/base/escape.h" 15 #include "net/base/escape.h"
15 #include "net/base/ip_address.h" 16 #include "net/base/ip_address.h"
16 #include "net/http/http_request_headers.h" 17 #include "net/http/http_request_headers.h"
17 #include "url/url_util.h" 18 #include "url/url_util.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 573
573 const std::string hash = base::SHA1HashString(packed_ip); 574 const std::string hash = base::SHA1HashString(packed_ip);
574 DCHECK_EQ(20u, hash.size()); 575 DCHECK_EQ(20u, hash.size());
575 hashed_encoded_ip->resize(hash.size() + 1); 576 hashed_encoded_ip->resize(hash.size() + 1);
576 hashed_encoded_ip->replace(0, hash.size(), hash); 577 hashed_encoded_ip->replace(0, hash.size(), hash);
577 (*hashed_encoded_ip)[hash.size()] = static_cast<unsigned char>(128); 578 (*hashed_encoded_ip)[hash.size()] = static_cast<unsigned char>(128);
578 return true; 579 return true;
579 } 580 }
580 581
581 } // namespace safe_browsing 582 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.h ('k') | components/suggestions/image_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698