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

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

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_database.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // Order |SBAddFullHash| on the prefix part. |SBAddPrefixLess()| from 323 // Order |SBAddFullHash| on the prefix part. |SBAddPrefixLess()| from
324 // safe_browsing_store.h orders on both chunk-id and prefix. 324 // safe_browsing_store.h orders on both chunk-id and prefix.
325 bool SBAddFullHashPrefixLess(const SBAddFullHash& a, const SBAddFullHash& b) { 325 bool SBAddFullHashPrefixLess(const SBAddFullHash& a, const SBAddFullHash& b) {
326 return a.full_hash.prefix < b.full_hash.prefix; 326 return a.full_hash.prefix < b.full_hash.prefix;
327 } 327 }
328 328
329 // This code always checks for non-zero file size. This helper makes 329 // This code always checks for non-zero file size. This helper makes
330 // that less verbose. 330 // that less verbose.
331 int64 GetFileSizeOrZero(const base::FilePath& file_path) { 331 int64 GetFileSizeOrZero(const base::FilePath& file_path) {
332 int64 size_64; 332 int64 size_64;
333 if (!file_util::GetFileSize(file_path, &size_64)) 333 if (!base::GetFileSize(file_path, &size_64))
334 return 0; 334 return 0;
335 return size_64; 335 return size_64;
336 } 336 }
337 337
338 } // namespace 338 } // namespace
339 339
340 // The default SafeBrowsingDatabaseFactory. 340 // The default SafeBrowsingDatabaseFactory.
341 class SafeBrowsingDatabaseFactoryImpl : public SafeBrowsingDatabaseFactory { 341 class SafeBrowsingDatabaseFactoryImpl : public SafeBrowsingDatabaseFactory {
342 public: 342 public:
343 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( 343 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase(
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 } 1783 }
1784 1784
1785 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { 1785 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() {
1786 SBFullHash malware_kill_switch; 1786 SBFullHash malware_kill_switch;
1787 crypto::SHA256HashString(kMalwareIPKillSwitchUrl, &malware_kill_switch, 1787 crypto::SHA256HashString(kMalwareIPKillSwitchUrl, &malware_kill_switch,
1788 sizeof(malware_kill_switch)); 1788 sizeof(malware_kill_switch));
1789 std::vector<SBFullHash> full_hashes; 1789 std::vector<SBFullHash> full_hashes;
1790 full_hashes.push_back(malware_kill_switch); 1790 full_hashes.push_back(malware_kill_switch);
1791 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); 1791 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes);
1792 } 1792 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set_unittest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_store_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698