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

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

Issue 220493003: Safebrowsing: change gethash caching to match api 2.3 rules, fix some corner cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes to fullhash / prefix handling Created 6 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 | Annotate | Revision Log
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 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 hiter != citer->hosts.end(); ++hiter) { 50 hiter != citer->hosts.end(); ++hiter) {
51 if (hiter->entry) { 51 if (hiter->entry) {
52 hiter->entry->Destroy(); 52 hiter->entry->Destroy();
53 hiter->entry = NULL; 53 hiter->entry = NULL;
54 } 54 }
55 } 55 }
56 } 56 }
57 chunks_.clear(); 57 chunks_.clear();
58 } 58 }
59 59
60 // SBCachedFullHashResult ------------------------------------------------------
61
62 SBCachedFullHashResult::SBCachedFullHashResult() {}
63
64 SBCachedFullHashResult::SBCachedFullHashResult(
65 const base::Time& in_expire_after)
66 : expire_after(in_expire_after) {}
67
68 SBCachedFullHashResult::~SBCachedFullHashResult() {}
69
60 // SBListChunkRanges ----------------------------------------------------------- 70 // SBListChunkRanges -----------------------------------------------------------
61 71
62 SBListChunkRanges::SBListChunkRanges(const std::string& n) : name(n) {} 72 SBListChunkRanges::SBListChunkRanges(const std::string& n) : name(n) {}
63 73
64 // SBChunkDelete --------------------------------------------------------------- 74 // SBChunkDelete ---------------------------------------------------------------
65 75
66 SBChunkDelete::SBChunkDelete() : is_sub_del(false) {} 76 SBChunkDelete::SBChunkDelete() : is_sub_del(false) {}
67 77
68 SBChunkDelete::~SBChunkDelete() {} 78 SBChunkDelete::~SBChunkDelete() {}
69 79
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length); 547 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length);
538 return hash_out; 548 return hash_out;
539 } 549 }
540 550
541 std::string SBFullHashToString(const SBFullHash& hash) { 551 std::string SBFullHashToString(const SBFullHash& hash) {
542 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); 552 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
543 return std::string(hash.full_hash, sizeof(hash.full_hash)); 553 return std::string(hash.full_hash, sizeof(hash.full_hash));
544 } 554 }
545 555
546 } // namespace safe_browsing_util 556 } // namespace safe_browsing_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698