OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sha2.h" | 10 #include "base/sha2.h" |
11 #include "chrome/browser/safe_browsing/safe_browsing_database_impl.h" | 11 #include "chrome/browser/safe_browsing/safe_browsing_database_impl.h" |
12 #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" | 12 #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
| 16 using base::Time; |
| 17 |
16 // Filename suffix for the bloom filter. | 18 // Filename suffix for the bloom filter. |
17 static const wchar_t kBloomFilterFile[] = L" Filter"; | 19 static const wchar_t kBloomFilterFile[] = L" Filter"; |
18 | 20 |
19 // Factory method. | 21 // Factory method. |
20 SafeBrowsingDatabase* SafeBrowsingDatabase::Create() { | 22 SafeBrowsingDatabase* SafeBrowsingDatabase::Create() { |
21 if (CommandLine().HasSwitch(switches::kUseNewSafeBrowsing)) | 23 if (CommandLine().HasSwitch(switches::kUseNewSafeBrowsing)) |
22 return new SafeBrowsingDatabaseBloom; | 24 return new SafeBrowsingDatabaseBloom; |
23 return new SafeBrowsingDatabaseImpl; | 25 return new SafeBrowsingDatabaseImpl; |
24 } | 26 } |
25 | 27 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (!bloom_filter_.get()) | 90 if (!bloom_filter_.get()) |
89 return; | 91 return; |
90 | 92 |
91 Time before = Time::Now(); | 93 Time before = Time::Now(); |
92 file_util::WriteFile(bloom_filter_filename_, | 94 file_util::WriteFile(bloom_filter_filename_, |
93 bloom_filter_->data(), | 95 bloom_filter_->data(), |
94 bloom_filter_->size()); | 96 bloom_filter_->size()); |
95 SB_DLOG(INFO) << "SafeBrowsingDatabase wrote bloom filter in " << | 97 SB_DLOG(INFO) << "SafeBrowsingDatabase wrote bloom filter in " << |
96 (Time::Now() - before).InMilliseconds() << " ms"; | 98 (Time::Now() - before).InMilliseconds() << " ms"; |
97 } | 99 } |
98 | |
OLD | NEW |