OLD | NEW |
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 } // namespace | 308 } // namespace |
309 | 309 |
310 // The default SafeBrowsingDatabaseFactory. | 310 // The default SafeBrowsingDatabaseFactory. |
311 class SafeBrowsingDatabaseFactoryImpl : public SafeBrowsingDatabaseFactory { | 311 class SafeBrowsingDatabaseFactoryImpl : public SafeBrowsingDatabaseFactory { |
312 public: | 312 public: |
313 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 313 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
314 bool enable_download_protection, | 314 bool enable_download_protection, |
315 bool enable_client_side_whitelist, | 315 bool enable_client_side_whitelist, |
316 bool enable_download_whitelist, | 316 bool enable_download_whitelist, |
317 bool enable_extension_blacklist) { | 317 bool enable_extension_blacklist) OVERRIDE { |
318 return new SafeBrowsingDatabaseNew( | 318 return new SafeBrowsingDatabaseNew( |
319 new SafeBrowsingStoreFile, | 319 new SafeBrowsingStoreFile, |
320 enable_download_protection ? new SafeBrowsingStoreFile : NULL, | 320 enable_download_protection ? new SafeBrowsingStoreFile : NULL, |
321 enable_client_side_whitelist ? new SafeBrowsingStoreFile : NULL, | 321 enable_client_side_whitelist ? new SafeBrowsingStoreFile : NULL, |
322 enable_download_whitelist ? new SafeBrowsingStoreFile : NULL, | 322 enable_download_whitelist ? new SafeBrowsingStoreFile : NULL, |
323 enable_extension_blacklist ? new SafeBrowsingStoreFile : NULL); | 323 enable_extension_blacklist ? new SafeBrowsingStoreFile : NULL); |
324 } | 324 } |
325 | 325 |
326 SafeBrowsingDatabaseFactoryImpl() { } | 326 SafeBrowsingDatabaseFactoryImpl() { } |
327 | 327 |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 if (std::binary_search(new_whitelist.begin(), new_whitelist.end(), | 1413 if (std::binary_search(new_whitelist.begin(), new_whitelist.end(), |
1414 kill_switch)) { | 1414 kill_switch)) { |
1415 // The kill switch is whitelisted hence we whitelist all URLs. | 1415 // The kill switch is whitelisted hence we whitelist all URLs. |
1416 WhitelistEverything(whitelist); | 1416 WhitelistEverything(whitelist); |
1417 } else { | 1417 } else { |
1418 base::AutoLock locked(lookup_lock_); | 1418 base::AutoLock locked(lookup_lock_); |
1419 whitelist->second = false; | 1419 whitelist->second = false; |
1420 whitelist->first.swap(new_whitelist); | 1420 whitelist->first.swap(new_whitelist); |
1421 } | 1421 } |
1422 } | 1422 } |
OLD | NEW |