| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 FILE_PATH_LITERAL(" Prefix Set"); | 45 FILE_PATH_LITERAL(" Prefix Set"); |
| 46 // Filename suffix for download store. | 46 // Filename suffix for download store. |
| 47 const base::FilePath::CharType kDownloadDBFile[] = | 47 const base::FilePath::CharType kDownloadDBFile[] = |
| 48 FILE_PATH_LITERAL(" Download"); | 48 FILE_PATH_LITERAL(" Download"); |
| 49 // Filename suffix for client-side phishing detection whitelist store. | 49 // Filename suffix for client-side phishing detection whitelist store. |
| 50 const base::FilePath::CharType kCsdWhitelistDBFile[] = | 50 const base::FilePath::CharType kCsdWhitelistDBFile[] = |
| 51 FILE_PATH_LITERAL(" Csd Whitelist"); | 51 FILE_PATH_LITERAL(" Csd Whitelist"); |
| 52 // Filename suffix for the download whitelist store. | 52 // Filename suffix for the download whitelist store. |
| 53 const base::FilePath::CharType kDownloadWhitelistDBFile[] = | 53 const base::FilePath::CharType kDownloadWhitelistDBFile[] = |
| 54 FILE_PATH_LITERAL(" Download Whitelist"); | 54 FILE_PATH_LITERAL(" Download Whitelist"); |
| 55 // Filename suffix for the off-domain inclusion whitelist store. |
| 56 const base::FilePath::CharType kInclusionWhitelistDBFile[] = |
| 57 FILE_PATH_LITERAL(" Inclusion Whitelist"); |
| 55 // Filename suffix for the extension blacklist store. | 58 // Filename suffix for the extension blacklist store. |
| 56 const base::FilePath::CharType kExtensionBlacklistDBFile[] = | 59 const base::FilePath::CharType kExtensionBlacklistDBFile[] = |
| 57 FILE_PATH_LITERAL(" Extension Blacklist"); | 60 FILE_PATH_LITERAL(" Extension Blacklist"); |
| 58 // Filename suffix for the side-effect free whitelist store. | 61 // Filename suffix for the side-effect free whitelist store. |
| 59 const base::FilePath::CharType kSideEffectFreeWhitelistDBFile[] = | 62 const base::FilePath::CharType kSideEffectFreeWhitelistDBFile[] = |
| 60 FILE_PATH_LITERAL(" Side-Effect Free Whitelist"); | 63 FILE_PATH_LITERAL(" Side-Effect Free Whitelist"); |
| 61 // Filename suffix for the csd malware IP blacklist store. | 64 // Filename suffix for the csd malware IP blacklist store. |
| 62 const base::FilePath::CharType kIPBlacklistDBFile[] = | 65 const base::FilePath::CharType kIPBlacklistDBFile[] = |
| 63 FILE_PATH_LITERAL(" IP Blacklist"); | 66 FILE_PATH_LITERAL(" IP Blacklist"); |
| 64 // Filename suffix for the unwanted software blacklist store. | 67 // Filename suffix for the unwanted software blacklist store. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 public: | 325 public: |
| 323 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 326 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
| 324 bool enable_download_protection, | 327 bool enable_download_protection, |
| 325 bool enable_client_side_whitelist, | 328 bool enable_client_side_whitelist, |
| 326 bool enable_download_whitelist, | 329 bool enable_download_whitelist, |
| 327 bool enable_extension_blacklist, | 330 bool enable_extension_blacklist, |
| 328 bool enable_side_effect_free_whitelist, | 331 bool enable_side_effect_free_whitelist, |
| 329 bool enable_ip_blacklist, | 332 bool enable_ip_blacklist, |
| 330 bool enable_unwanted_software_list) override { | 333 bool enable_unwanted_software_list) override { |
| 331 return new SafeBrowsingDatabaseNew( | 334 return new SafeBrowsingDatabaseNew( |
| 332 new SafeBrowsingStoreFile, | 335 new SafeBrowsingStoreFile, // browse_store |
| 333 enable_download_protection ? new SafeBrowsingStoreFile : NULL, | 336 enable_download_protection ? new SafeBrowsingStoreFile : NULL, |
| 334 enable_client_side_whitelist ? new SafeBrowsingStoreFile : NULL, | 337 enable_client_side_whitelist ? new SafeBrowsingStoreFile : NULL, |
| 335 enable_download_whitelist ? new SafeBrowsingStoreFile : NULL, | 338 enable_download_whitelist ? new SafeBrowsingStoreFile : NULL, |
| 339 new SafeBrowsingStoreFile, // inclusion_whitelist_store |
| 336 enable_extension_blacklist ? new SafeBrowsingStoreFile : NULL, | 340 enable_extension_blacklist ? new SafeBrowsingStoreFile : NULL, |
| 337 enable_side_effect_free_whitelist ? new SafeBrowsingStoreFile : NULL, | 341 enable_side_effect_free_whitelist ? new SafeBrowsingStoreFile : NULL, |
| 338 enable_ip_blacklist ? new SafeBrowsingStoreFile : NULL, | 342 enable_ip_blacklist ? new SafeBrowsingStoreFile : NULL, |
| 339 enable_unwanted_software_list ? new SafeBrowsingStoreFile : NULL); | 343 enable_unwanted_software_list ? new SafeBrowsingStoreFile : NULL); |
| 340 } | 344 } |
| 341 | 345 |
| 342 SafeBrowsingDatabaseFactoryImpl() { } | 346 SafeBrowsingDatabaseFactoryImpl() { } |
| 343 | 347 |
| 344 private: | 348 private: |
| 345 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactoryImpl); | 349 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactoryImpl); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 return base::FilePath(db_filename.value() + kCsdWhitelistDBFile); | 409 return base::FilePath(db_filename.value() + kCsdWhitelistDBFile); |
| 406 } | 410 } |
| 407 | 411 |
| 408 // static | 412 // static |
| 409 base::FilePath SafeBrowsingDatabase::DownloadWhitelistDBFilename( | 413 base::FilePath SafeBrowsingDatabase::DownloadWhitelistDBFilename( |
| 410 const base::FilePath& db_filename) { | 414 const base::FilePath& db_filename) { |
| 411 return base::FilePath(db_filename.value() + kDownloadWhitelistDBFile); | 415 return base::FilePath(db_filename.value() + kDownloadWhitelistDBFile); |
| 412 } | 416 } |
| 413 | 417 |
| 414 // static | 418 // static |
| 419 base::FilePath SafeBrowsingDatabase::InclusionWhitelistDBFilename( |
| 420 const base::FilePath& db_filename) { |
| 421 return base::FilePath(db_filename.value() + kInclusionWhitelistDBFile); |
| 422 } |
| 423 |
| 424 // static |
| 415 base::FilePath SafeBrowsingDatabase::ExtensionBlacklistDBFilename( | 425 base::FilePath SafeBrowsingDatabase::ExtensionBlacklistDBFilename( |
| 416 const base::FilePath& db_filename) { | 426 const base::FilePath& db_filename) { |
| 417 return base::FilePath(db_filename.value() + kExtensionBlacklistDBFile); | 427 return base::FilePath(db_filename.value() + kExtensionBlacklistDBFile); |
| 418 } | 428 } |
| 419 | 429 |
| 420 // static | 430 // static |
| 421 base::FilePath SafeBrowsingDatabase::SideEffectFreeWhitelistDBFilename( | 431 base::FilePath SafeBrowsingDatabase::SideEffectFreeWhitelistDBFilename( |
| 422 const base::FilePath& db_filename) { | 432 const base::FilePath& db_filename) { |
| 423 return base::FilePath(db_filename.value() + kSideEffectFreeWhitelistDBFile); | 433 return base::FilePath(db_filename.value() + kSideEffectFreeWhitelistDBFile); |
| 424 } | 434 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 441 | 451 |
| 442 if (list_id == safe_browsing_util::PHISH || | 452 if (list_id == safe_browsing_util::PHISH || |
| 443 list_id == safe_browsing_util::MALWARE) { | 453 list_id == safe_browsing_util::MALWARE) { |
| 444 return browse_store_.get(); | 454 return browse_store_.get(); |
| 445 } else if (list_id == safe_browsing_util::BINURL) { | 455 } else if (list_id == safe_browsing_util::BINURL) { |
| 446 return download_store_.get(); | 456 return download_store_.get(); |
| 447 } else if (list_id == safe_browsing_util::CSDWHITELIST) { | 457 } else if (list_id == safe_browsing_util::CSDWHITELIST) { |
| 448 return csd_whitelist_store_.get(); | 458 return csd_whitelist_store_.get(); |
| 449 } else if (list_id == safe_browsing_util::DOWNLOADWHITELIST) { | 459 } else if (list_id == safe_browsing_util::DOWNLOADWHITELIST) { |
| 450 return download_whitelist_store_.get(); | 460 return download_whitelist_store_.get(); |
| 461 } else if (list_id == safe_browsing_util::INCLUSIONWHITELIST) { |
| 462 return inclusion_whitelist_store_.get(); |
| 451 } else if (list_id == safe_browsing_util::EXTENSIONBLACKLIST) { | 463 } else if (list_id == safe_browsing_util::EXTENSIONBLACKLIST) { |
| 452 return extension_blacklist_store_.get(); | 464 return extension_blacklist_store_.get(); |
| 453 } else if (list_id == safe_browsing_util::SIDEEFFECTFREEWHITELIST) { | 465 } else if (list_id == safe_browsing_util::SIDEEFFECTFREEWHITELIST) { |
| 454 return side_effect_free_whitelist_store_.get(); | 466 return side_effect_free_whitelist_store_.get(); |
| 455 } else if (list_id == safe_browsing_util::IPBLACKLIST) { | 467 } else if (list_id == safe_browsing_util::IPBLACKLIST) { |
| 456 return ip_blacklist_store_.get(); | 468 return ip_blacklist_store_.get(); |
| 457 } else if (list_id == safe_browsing_util::UNWANTEDURL) { | 469 } else if (list_id == safe_browsing_util::UNWANTEDURL) { |
| 458 return unwanted_software_store_.get(); | 470 return unwanted_software_store_.get(); |
| 459 } | 471 } |
| 460 return NULL; | 472 return NULL; |
| 461 } | 473 } |
| 462 | 474 |
| 463 // static | 475 // static |
| 464 void SafeBrowsingDatabase::RecordFailure(FailureType failure_type) { | 476 void SafeBrowsingDatabase::RecordFailure(FailureType failure_type) { |
| 465 UMA_HISTOGRAM_ENUMERATION("SB2.DatabaseFailure", failure_type, | 477 UMA_HISTOGRAM_ENUMERATION("SB2.DatabaseFailure", failure_type, |
| 466 FAILURE_DATABASE_MAX); | 478 FAILURE_DATABASE_MAX); |
| 467 } | 479 } |
| 468 | 480 |
| 469 class SafeBrowsingDatabaseNew::ThreadSafeStateManager::ReadTransaction { | 481 class SafeBrowsingDatabaseNew::ThreadSafeStateManager::ReadTransaction { |
| 470 public: | 482 public: |
| 471 const SBWhitelist* GetSBWhitelist(SBWhitelistId id) { | 483 const SBWhitelist* GetSBWhitelist(SBWhitelistId id) { |
| 472 switch (id) { | 484 switch (id) { |
| 473 case SBWhitelistId::CSD: | 485 case SBWhitelistId::CSD: |
| 474 return &outer_->csd_whitelist_; | 486 return &outer_->csd_whitelist_; |
| 475 case SBWhitelistId::DOWNLOAD: | 487 case SBWhitelistId::DOWNLOAD: |
| 476 return &outer_->download_whitelist_; | 488 return &outer_->download_whitelist_; |
| 489 case SBWhitelistId::INCLUSION: |
| 490 return &outer_->inclusion_whitelist_; |
| 477 } | 491 } |
| 478 NOTREACHED(); | 492 NOTREACHED(); |
| 479 return nullptr; | 493 return nullptr; |
| 480 } | 494 } |
| 481 | 495 |
| 482 const IPBlacklist* ip_blacklist() { return &outer_->ip_blacklist_; } | 496 const IPBlacklist* ip_blacklist() { return &outer_->ip_blacklist_; } |
| 483 | 497 |
| 484 const PrefixSet* GetPrefixSet(PrefixSetId id) { | 498 const PrefixSet* GetPrefixSet(PrefixSetId id) { |
| 485 switch (id) { | 499 switch (id) { |
| 486 case PrefixSetId::BROWSE: | 500 case PrefixSetId::BROWSE: |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DCHECK(outer_); | 594 DCHECK(outer_); |
| 581 DCHECK(outer_->thread_checker_.CalledOnValidThread()); | 595 DCHECK(outer_->thread_checker_.CalledOnValidThread()); |
| 582 } | 596 } |
| 583 | 597 |
| 584 SBWhitelist* SBWhitelistForId(SBWhitelistId id) { | 598 SBWhitelist* SBWhitelistForId(SBWhitelistId id) { |
| 585 switch (id) { | 599 switch (id) { |
| 586 case SBWhitelistId::CSD: | 600 case SBWhitelistId::CSD: |
| 587 return &outer_->csd_whitelist_; | 601 return &outer_->csd_whitelist_; |
| 588 case SBWhitelistId::DOWNLOAD: | 602 case SBWhitelistId::DOWNLOAD: |
| 589 return &outer_->download_whitelist_; | 603 return &outer_->download_whitelist_; |
| 604 case SBWhitelistId::INCLUSION: |
| 605 return &outer_->inclusion_whitelist_; |
| 590 } | 606 } |
| 591 NOTREACHED(); | 607 NOTREACHED(); |
| 592 return nullptr; | 608 return nullptr; |
| 593 } | 609 } |
| 594 | 610 |
| 595 ThreadSafeStateManager* outer_; | 611 ThreadSafeStateManager* outer_; |
| 596 base::AutoLock transaction_lock_; | 612 base::AutoLock transaction_lock_; |
| 597 | 613 |
| 598 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); | 614 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); |
| 599 }; | 615 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 617 return make_scoped_ptr(new ReadTransaction( | 633 return make_scoped_ptr(new ReadTransaction( |
| 618 this, ReadTransaction::AutoLockRequirement::DONT_LOCK_ON_MAIN_THREAD)); | 634 this, ReadTransaction::AutoLockRequirement::DONT_LOCK_ON_MAIN_THREAD)); |
| 619 } | 635 } |
| 620 | 636 |
| 621 scoped_ptr<SafeBrowsingDatabaseNew::WriteTransaction> | 637 scoped_ptr<SafeBrowsingDatabaseNew::WriteTransaction> |
| 622 SafeBrowsingDatabaseNew::ThreadSafeStateManager::BeginWriteTransaction() { | 638 SafeBrowsingDatabaseNew::ThreadSafeStateManager::BeginWriteTransaction() { |
| 623 return make_scoped_ptr(new WriteTransaction(this)); | 639 return make_scoped_ptr(new WriteTransaction(this)); |
| 624 } | 640 } |
| 625 | 641 |
| 626 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew() | 642 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew() |
| 627 : SafeBrowsingDatabaseNew(new SafeBrowsingStoreFile, | 643 : SafeBrowsingDatabaseNew(new SafeBrowsingStoreFile, // browse_store |
| 628 NULL, | 644 NULL, // download_store |
| 629 NULL, | 645 NULL, // csd_whitelist_store |
| 630 NULL, | 646 NULL, // download_whitelist_store |
| 631 NULL, | 647 NULL, // inclusion_whitelist_store |
| 632 NULL, | 648 NULL, // extension_blacklist_store |
| 633 NULL, | 649 NULL, // side_effect_free_whitelist_store |
| 634 NULL) { | 650 NULL, // ip_blacklist_store |
| 651 NULL) { // unwanted_software_store |
| 635 DCHECK(browse_store_.get()); | 652 DCHECK(browse_store_.get()); |
| 636 DCHECK(!download_store_.get()); | 653 DCHECK(!download_store_.get()); |
| 637 DCHECK(!csd_whitelist_store_.get()); | 654 DCHECK(!csd_whitelist_store_.get()); |
| 638 DCHECK(!download_whitelist_store_.get()); | 655 DCHECK(!download_whitelist_store_.get()); |
| 656 DCHECK(!inclusion_whitelist_store_.get()); |
| 639 DCHECK(!extension_blacklist_store_.get()); | 657 DCHECK(!extension_blacklist_store_.get()); |
| 640 DCHECK(!side_effect_free_whitelist_store_.get()); | 658 DCHECK(!side_effect_free_whitelist_store_.get()); |
| 641 DCHECK(!ip_blacklist_store_.get()); | 659 DCHECK(!ip_blacklist_store_.get()); |
| 642 DCHECK(!unwanted_software_store_.get()); | 660 DCHECK(!unwanted_software_store_.get()); |
| 643 } | 661 } |
| 644 | 662 |
| 645 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew( | 663 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew( |
| 646 SafeBrowsingStore* browse_store, | 664 SafeBrowsingStore* browse_store, |
| 647 SafeBrowsingStore* download_store, | 665 SafeBrowsingStore* download_store, |
| 648 SafeBrowsingStore* csd_whitelist_store, | 666 SafeBrowsingStore* csd_whitelist_store, |
| 649 SafeBrowsingStore* download_whitelist_store, | 667 SafeBrowsingStore* download_whitelist_store, |
| 668 SafeBrowsingStore* inclusion_whitelist_store, |
| 650 SafeBrowsingStore* extension_blacklist_store, | 669 SafeBrowsingStore* extension_blacklist_store, |
| 651 SafeBrowsingStore* side_effect_free_whitelist_store, | 670 SafeBrowsingStore* side_effect_free_whitelist_store, |
| 652 SafeBrowsingStore* ip_blacklist_store, | 671 SafeBrowsingStore* ip_blacklist_store, |
| 653 SafeBrowsingStore* unwanted_software_store) | 672 SafeBrowsingStore* unwanted_software_store) |
| 654 : state_manager_(thread_checker_), | 673 : state_manager_(thread_checker_), |
| 655 browse_store_(browse_store), | 674 browse_store_(browse_store), |
| 656 download_store_(download_store), | 675 download_store_(download_store), |
| 657 csd_whitelist_store_(csd_whitelist_store), | 676 csd_whitelist_store_(csd_whitelist_store), |
| 658 download_whitelist_store_(download_whitelist_store), | 677 download_whitelist_store_(download_whitelist_store), |
| 678 inclusion_whitelist_store_(inclusion_whitelist_store), |
| 659 extension_blacklist_store_(extension_blacklist_store), | 679 extension_blacklist_store_(extension_blacklist_store), |
| 660 side_effect_free_whitelist_store_(side_effect_free_whitelist_store), | 680 side_effect_free_whitelist_store_(side_effect_free_whitelist_store), |
| 661 ip_blacklist_store_(ip_blacklist_store), | 681 ip_blacklist_store_(ip_blacklist_store), |
| 662 unwanted_software_store_(unwanted_software_store), | 682 unwanted_software_store_(unwanted_software_store), |
| 663 corruption_detected_(false), | 683 corruption_detected_(false), |
| 664 change_detected_(false), | 684 change_detected_(false), |
| 665 reset_factory_(this) { | 685 reset_factory_(this) { |
| 666 DCHECK(browse_store_.get()); | 686 DCHECK(browse_store_.get()); |
| 667 } | 687 } |
| 668 | 688 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 LoadWhitelist(full_hashes, SBWhitelistId::DOWNLOAD); | 795 LoadWhitelist(full_hashes, SBWhitelistId::DOWNLOAD); |
| 776 } else { | 796 } else { |
| 777 state_manager_.BeginWriteTransaction()->WhitelistEverything( | 797 state_manager_.BeginWriteTransaction()->WhitelistEverything( |
| 778 SBWhitelistId::DOWNLOAD); | 798 SBWhitelistId::DOWNLOAD); |
| 779 } | 799 } |
| 780 } else { | 800 } else { |
| 781 state_manager_.BeginWriteTransaction()->WhitelistEverything( | 801 state_manager_.BeginWriteTransaction()->WhitelistEverything( |
| 782 SBWhitelistId::DOWNLOAD); // Just to be safe. | 802 SBWhitelistId::DOWNLOAD); // Just to be safe. |
| 783 } | 803 } |
| 784 | 804 |
| 805 if (inclusion_whitelist_store_.get()) { |
| 806 inclusion_whitelist_store_->Init( |
| 807 InclusionWhitelistDBFilename(filename_base_), |
| 808 base::Bind(&SafeBrowsingDatabaseNew::HandleCorruptDatabase, |
| 809 base::Unretained(this))); |
| 810 |
| 811 std::vector<SBAddFullHash> full_hashes; |
| 812 if (inclusion_whitelist_store_->GetAddFullHashes(&full_hashes)) { |
| 813 LoadWhitelist(full_hashes, SBWhitelistId::INCLUSION); |
| 814 } else { |
| 815 state_manager_.BeginWriteTransaction()->WhitelistEverything( |
| 816 SBWhitelistId::INCLUSION); |
| 817 } |
| 818 } else { |
| 819 state_manager_.BeginWriteTransaction()->WhitelistEverything( |
| 820 SBWhitelistId::INCLUSION); // Just to be safe. |
| 821 } |
| 822 |
| 785 if (extension_blacklist_store_.get()) { | 823 if (extension_blacklist_store_.get()) { |
| 786 extension_blacklist_store_->Init( | 824 extension_blacklist_store_->Init( |
| 787 ExtensionBlacklistDBFilename(filename_base_), | 825 ExtensionBlacklistDBFilename(filename_base_), |
| 788 base::Bind(&SafeBrowsingDatabaseNew::HandleCorruptDatabase, | 826 base::Bind(&SafeBrowsingDatabaseNew::HandleCorruptDatabase, |
| 789 base::Unretained(this))); | 827 base::Unretained(this))); |
| 790 } | 828 } |
| 791 | 829 |
| 792 if (ip_blacklist_store_.get()) { | 830 if (ip_blacklist_store_.get()) { |
| 793 ip_blacklist_store_->Init( | 831 ip_blacklist_store_->Init( |
| 794 IpBlacklistDBFilename(filename_base_), | 832 IpBlacklistDBFilename(filename_base_), |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 UrlToFullHashes(url, true, &full_hashes); | 962 UrlToFullHashes(url, true, &full_hashes); |
| 925 return ContainsWhitelistedHashes(SBWhitelistId::CSD, full_hashes); | 963 return ContainsWhitelistedHashes(SBWhitelistId::CSD, full_hashes); |
| 926 } | 964 } |
| 927 | 965 |
| 928 bool SafeBrowsingDatabaseNew::ContainsDownloadWhitelistedUrl(const GURL& url) { | 966 bool SafeBrowsingDatabaseNew::ContainsDownloadWhitelistedUrl(const GURL& url) { |
| 929 std::vector<SBFullHash> full_hashes; | 967 std::vector<SBFullHash> full_hashes; |
| 930 UrlToFullHashes(url, true, &full_hashes); | 968 UrlToFullHashes(url, true, &full_hashes); |
| 931 return ContainsWhitelistedHashes(SBWhitelistId::DOWNLOAD, full_hashes); | 969 return ContainsWhitelistedHashes(SBWhitelistId::DOWNLOAD, full_hashes); |
| 932 } | 970 } |
| 933 | 971 |
| 972 bool SafeBrowsingDatabaseNew::ContainsInclusionWhitelistedUrl(const GURL& url) { |
| 973 std::vector<SBFullHash> full_hashes; |
| 974 UrlToFullHashes(url, true, &full_hashes); |
| 975 return ContainsWhitelistedHashes(SBWhitelistId::INCLUSION, full_hashes); |
| 976 } |
| 977 |
| 934 bool SafeBrowsingDatabaseNew::ContainsExtensionPrefixes( | 978 bool SafeBrowsingDatabaseNew::ContainsExtensionPrefixes( |
| 935 const std::vector<SBPrefix>& prefixes, | 979 const std::vector<SBPrefix>& prefixes, |
| 936 std::vector<SBPrefix>* prefix_hits) { | 980 std::vector<SBPrefix>* prefix_hits) { |
| 937 DCHECK(thread_checker_.CalledOnValidThread()); | 981 DCHECK(thread_checker_.CalledOnValidThread()); |
| 938 | 982 |
| 939 if (!extension_blacklist_store_) | 983 if (!extension_blacklist_store_) |
| 940 return false; | 984 return false; |
| 941 | 985 |
| 942 return MatchAddPrefixes(extension_blacklist_store_.get(), | 986 return MatchAddPrefixes(extension_blacklist_store_.get(), |
| 943 safe_browsing_util::EXTENSIONBLACKLIST % 2, | 987 safe_browsing_util::EXTENSIONBLACKLIST % 2, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 return false; | 1249 return false; |
| 1206 } | 1250 } |
| 1207 | 1251 |
| 1208 if (download_whitelist_store_.get() && | 1252 if (download_whitelist_store_.get() && |
| 1209 !download_whitelist_store_->BeginUpdate()) { | 1253 !download_whitelist_store_->BeginUpdate()) { |
| 1210 RecordFailure(FAILURE_WHITELIST_DATABASE_UPDATE_BEGIN); | 1254 RecordFailure(FAILURE_WHITELIST_DATABASE_UPDATE_BEGIN); |
| 1211 HandleCorruptDatabase(); | 1255 HandleCorruptDatabase(); |
| 1212 return false; | 1256 return false; |
| 1213 } | 1257 } |
| 1214 | 1258 |
| 1259 if (inclusion_whitelist_store_.get() && |
| 1260 !inclusion_whitelist_store_->BeginUpdate()) { |
| 1261 RecordFailure(FAILURE_WHITELIST_DATABASE_UPDATE_BEGIN); |
| 1262 HandleCorruptDatabase(); |
| 1263 return false; |
| 1264 } |
| 1265 |
| 1215 if (extension_blacklist_store_ && | 1266 if (extension_blacklist_store_ && |
| 1216 !extension_blacklist_store_->BeginUpdate()) { | 1267 !extension_blacklist_store_->BeginUpdate()) { |
| 1217 RecordFailure(FAILURE_EXTENSION_BLACKLIST_UPDATE_BEGIN); | 1268 RecordFailure(FAILURE_EXTENSION_BLACKLIST_UPDATE_BEGIN); |
| 1218 HandleCorruptDatabase(); | 1269 HandleCorruptDatabase(); |
| 1219 return false; | 1270 return false; |
| 1220 } | 1271 } |
| 1221 | 1272 |
| 1222 if (side_effect_free_whitelist_store_ && | 1273 if (side_effect_free_whitelist_store_ && |
| 1223 !side_effect_free_whitelist_store_->BeginUpdate()) { | 1274 !side_effect_free_whitelist_store_->BeginUpdate()) { |
| 1224 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_UPDATE_BEGIN); | 1275 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_UPDATE_BEGIN); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1253 // extra data of that sort. | 1304 // extra data of that sort. |
| 1254 UpdateChunkRangesForList(download_store_.get(), | 1305 UpdateChunkRangesForList(download_store_.get(), |
| 1255 safe_browsing_util::kBinUrlList, lists); | 1306 safe_browsing_util::kBinUrlList, lists); |
| 1256 | 1307 |
| 1257 UpdateChunkRangesForList(csd_whitelist_store_.get(), | 1308 UpdateChunkRangesForList(csd_whitelist_store_.get(), |
| 1258 safe_browsing_util::kCsdWhiteList, lists); | 1309 safe_browsing_util::kCsdWhiteList, lists); |
| 1259 | 1310 |
| 1260 UpdateChunkRangesForList(download_whitelist_store_.get(), | 1311 UpdateChunkRangesForList(download_whitelist_store_.get(), |
| 1261 safe_browsing_util::kDownloadWhiteList, lists); | 1312 safe_browsing_util::kDownloadWhiteList, lists); |
| 1262 | 1313 |
| 1314 UpdateChunkRangesForList(inclusion_whitelist_store_.get(), |
| 1315 safe_browsing_util::kInclusionWhitelist, lists); |
| 1316 |
| 1263 UpdateChunkRangesForList(extension_blacklist_store_.get(), | 1317 UpdateChunkRangesForList(extension_blacklist_store_.get(), |
| 1264 safe_browsing_util::kExtensionBlacklist, lists); | 1318 safe_browsing_util::kExtensionBlacklist, lists); |
| 1265 | 1319 |
| 1266 UpdateChunkRangesForList(side_effect_free_whitelist_store_.get(), | 1320 UpdateChunkRangesForList(side_effect_free_whitelist_store_.get(), |
| 1267 safe_browsing_util::kSideEffectFreeWhitelist, lists); | 1321 safe_browsing_util::kSideEffectFreeWhitelist, lists); |
| 1268 | 1322 |
| 1269 UpdateChunkRangesForList(ip_blacklist_store_.get(), | 1323 UpdateChunkRangesForList(ip_blacklist_store_.get(), |
| 1270 safe_browsing_util::kIPBlacklist, lists); | 1324 safe_browsing_util::kIPBlacklist, lists); |
| 1271 | 1325 |
| 1272 UpdateChunkRangesForList(unwanted_software_store_.get(), | 1326 UpdateChunkRangesForList(unwanted_software_store_.get(), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1295 DLOG(ERROR) << "Safe-browsing download database corrupt."; | 1349 DLOG(ERROR) << "Safe-browsing download database corrupt."; |
| 1296 | 1350 |
| 1297 if (csd_whitelist_store_.get() && !csd_whitelist_store_->CheckValidity()) | 1351 if (csd_whitelist_store_.get() && !csd_whitelist_store_->CheckValidity()) |
| 1298 DLOG(ERROR) << "Safe-browsing csd whitelist database corrupt."; | 1352 DLOG(ERROR) << "Safe-browsing csd whitelist database corrupt."; |
| 1299 | 1353 |
| 1300 if (download_whitelist_store_.get() && | 1354 if (download_whitelist_store_.get() && |
| 1301 !download_whitelist_store_->CheckValidity()) { | 1355 !download_whitelist_store_->CheckValidity()) { |
| 1302 DLOG(ERROR) << "Safe-browsing download whitelist database corrupt."; | 1356 DLOG(ERROR) << "Safe-browsing download whitelist database corrupt."; |
| 1303 } | 1357 } |
| 1304 | 1358 |
| 1359 if (inclusion_whitelist_store_.get() && |
| 1360 !inclusion_whitelist_store_->CheckValidity()) { |
| 1361 DLOG(ERROR) << "Safe-browsing inclusion whitelist database corrupt."; |
| 1362 } |
| 1363 |
| 1305 if (extension_blacklist_store_ && | 1364 if (extension_blacklist_store_ && |
| 1306 !extension_blacklist_store_->CheckValidity()) { | 1365 !extension_blacklist_store_->CheckValidity()) { |
| 1307 DLOG(ERROR) << "Safe-browsing extension blacklist database corrupt."; | 1366 DLOG(ERROR) << "Safe-browsing extension blacklist database corrupt."; |
| 1308 } | 1367 } |
| 1309 | 1368 |
| 1310 if (side_effect_free_whitelist_store_ && | 1369 if (side_effect_free_whitelist_store_ && |
| 1311 !side_effect_free_whitelist_store_->CheckValidity()) { | 1370 !side_effect_free_whitelist_store_->CheckValidity()) { |
| 1312 DLOG(ERROR) << "Safe-browsing side-effect free whitelist database " | 1371 DLOG(ERROR) << "Safe-browsing side-effect free whitelist database " |
| 1313 << "corrupt."; | 1372 << "corrupt."; |
| 1314 } | 1373 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1333 // Track empty updates to answer questions at http://crbug.com/72216 . | 1392 // Track empty updates to answer questions at http://crbug.com/72216 . |
| 1334 if (update_succeeded && !change_detected_) | 1393 if (update_succeeded && !change_detected_) |
| 1335 UMA_HISTOGRAM_COUNTS("SB2.DatabaseUpdateKilobytes", 0); | 1394 UMA_HISTOGRAM_COUNTS("SB2.DatabaseUpdateKilobytes", 0); |
| 1336 browse_store_->CancelUpdate(); | 1395 browse_store_->CancelUpdate(); |
| 1337 if (download_store_.get()) | 1396 if (download_store_.get()) |
| 1338 download_store_->CancelUpdate(); | 1397 download_store_->CancelUpdate(); |
| 1339 if (csd_whitelist_store_.get()) | 1398 if (csd_whitelist_store_.get()) |
| 1340 csd_whitelist_store_->CancelUpdate(); | 1399 csd_whitelist_store_->CancelUpdate(); |
| 1341 if (download_whitelist_store_.get()) | 1400 if (download_whitelist_store_.get()) |
| 1342 download_whitelist_store_->CancelUpdate(); | 1401 download_whitelist_store_->CancelUpdate(); |
| 1402 if (inclusion_whitelist_store_.get()) |
| 1403 inclusion_whitelist_store_->CancelUpdate(); |
| 1343 if (extension_blacklist_store_) | 1404 if (extension_blacklist_store_) |
| 1344 extension_blacklist_store_->CancelUpdate(); | 1405 extension_blacklist_store_->CancelUpdate(); |
| 1345 if (side_effect_free_whitelist_store_) | 1406 if (side_effect_free_whitelist_store_) |
| 1346 side_effect_free_whitelist_store_->CancelUpdate(); | 1407 side_effect_free_whitelist_store_->CancelUpdate(); |
| 1347 if (ip_blacklist_store_) | 1408 if (ip_blacklist_store_) |
| 1348 ip_blacklist_store_->CancelUpdate(); | 1409 ip_blacklist_store_->CancelUpdate(); |
| 1349 if (unwanted_software_store_) | 1410 if (unwanted_software_store_) |
| 1350 unwanted_software_store_->CancelUpdate(); | 1411 unwanted_software_store_->CancelUpdate(); |
| 1351 return; | 1412 return; |
| 1352 } | 1413 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1363 FAILURE_BROWSE_DATABASE_UPDATE_FINISH, | 1424 FAILURE_BROWSE_DATABASE_UPDATE_FINISH, |
| 1364 FAILURE_BROWSE_PREFIX_SET_WRITE, | 1425 FAILURE_BROWSE_PREFIX_SET_WRITE, |
| 1365 true); | 1426 true); |
| 1366 | 1427 |
| 1367 UpdateWhitelistStore(CsdWhitelistDBFilename(filename_base_), | 1428 UpdateWhitelistStore(CsdWhitelistDBFilename(filename_base_), |
| 1368 csd_whitelist_store_.get(), | 1429 csd_whitelist_store_.get(), |
| 1369 SBWhitelistId::CSD); | 1430 SBWhitelistId::CSD); |
| 1370 UpdateWhitelistStore(DownloadWhitelistDBFilename(filename_base_), | 1431 UpdateWhitelistStore(DownloadWhitelistDBFilename(filename_base_), |
| 1371 download_whitelist_store_.get(), | 1432 download_whitelist_store_.get(), |
| 1372 SBWhitelistId::DOWNLOAD); | 1433 SBWhitelistId::DOWNLOAD); |
| 1434 UpdateWhitelistStore(InclusionWhitelistDBFilename(filename_base_), |
| 1435 inclusion_whitelist_store_.get(), |
| 1436 SBWhitelistId::INCLUSION); |
| 1373 | 1437 |
| 1374 if (extension_blacklist_store_) { | 1438 if (extension_blacklist_store_) { |
| 1375 UpdateHashPrefixStore(ExtensionBlacklistDBFilename(filename_base_), | 1439 UpdateHashPrefixStore(ExtensionBlacklistDBFilename(filename_base_), |
| 1376 extension_blacklist_store_.get(), | 1440 extension_blacklist_store_.get(), |
| 1377 FAILURE_EXTENSION_BLACKLIST_UPDATE_FINISH); | 1441 FAILURE_EXTENSION_BLACKLIST_UPDATE_FINISH); |
| 1378 } | 1442 } |
| 1379 | 1443 |
| 1380 if (side_effect_free_whitelist_store_) { | 1444 if (side_effect_free_whitelist_store_) { |
| 1381 UpdatePrefixSetUrlStore(SideEffectFreeWhitelistDBFilename(filename_base_), | 1445 UpdatePrefixSetUrlStore(SideEffectFreeWhitelistDBFilename(filename_base_), |
| 1382 side_effect_free_whitelist_store_.get(), | 1446 side_effect_free_whitelist_store_.get(), |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 const bool r3 = csd_whitelist_store_.get() ? | 1705 const bool r3 = csd_whitelist_store_.get() ? |
| 1642 csd_whitelist_store_->Delete() : true; | 1706 csd_whitelist_store_->Delete() : true; |
| 1643 if (!r3) | 1707 if (!r3) |
| 1644 RecordFailure(FAILURE_DATABASE_STORE_DELETE); | 1708 RecordFailure(FAILURE_DATABASE_STORE_DELETE); |
| 1645 | 1709 |
| 1646 const bool r4 = download_whitelist_store_.get() ? | 1710 const bool r4 = download_whitelist_store_.get() ? |
| 1647 download_whitelist_store_->Delete() : true; | 1711 download_whitelist_store_->Delete() : true; |
| 1648 if (!r4) | 1712 if (!r4) |
| 1649 RecordFailure(FAILURE_DATABASE_STORE_DELETE); | 1713 RecordFailure(FAILURE_DATABASE_STORE_DELETE); |
| 1650 | 1714 |
| 1715 const bool r5 = inclusion_whitelist_store_.get() ? |
| 1716 inclusion_whitelist_store_->Delete() : true; |
| 1717 if (!r5) |
| 1718 RecordFailure(FAILURE_DATABASE_STORE_DELETE); |
| 1719 |
| 1651 const base::FilePath browse_filename = BrowseDBFilename(filename_base_); | 1720 const base::FilePath browse_filename = BrowseDBFilename(filename_base_); |
| 1652 const base::FilePath bloom_filter_filename = | 1721 const base::FilePath bloom_filter_filename = |
| 1653 BloomFilterForFilename(browse_filename); | 1722 BloomFilterForFilename(browse_filename); |
| 1654 const bool r5 = base::DeleteFile(bloom_filter_filename, false); | 1723 const bool r6 = base::DeleteFile(bloom_filter_filename, false); |
| 1655 if (!r5) | 1724 if (!r6) |
| 1656 RecordFailure(FAILURE_DATABASE_FILTER_DELETE); | 1725 RecordFailure(FAILURE_DATABASE_FILTER_DELETE); |
| 1657 | 1726 |
| 1658 const base::FilePath browse_prefix_set_filename = | 1727 const base::FilePath browse_prefix_set_filename = |
| 1659 PrefixSetForFilename(browse_filename); | 1728 PrefixSetForFilename(browse_filename); |
| 1660 const bool r6 = base::DeleteFile(browse_prefix_set_filename, false); | 1729 const bool r7 = base::DeleteFile(browse_prefix_set_filename, false); |
| 1661 if (!r6) | 1730 if (!r7) |
| 1662 RecordFailure(FAILURE_BROWSE_PREFIX_SET_DELETE); | 1731 RecordFailure(FAILURE_BROWSE_PREFIX_SET_DELETE); |
| 1663 | 1732 |
| 1664 const base::FilePath extension_blacklist_filename = | 1733 const base::FilePath extension_blacklist_filename = |
| 1665 ExtensionBlacklistDBFilename(filename_base_); | 1734 ExtensionBlacklistDBFilename(filename_base_); |
| 1666 const bool r7 = base::DeleteFile(extension_blacklist_filename, false); | 1735 const bool r8 = base::DeleteFile(extension_blacklist_filename, false); |
| 1667 if (!r7) | 1736 if (!r8) |
| 1668 RecordFailure(FAILURE_EXTENSION_BLACKLIST_DELETE); | 1737 RecordFailure(FAILURE_EXTENSION_BLACKLIST_DELETE); |
| 1669 | 1738 |
| 1670 const base::FilePath side_effect_free_whitelist_filename = | 1739 const base::FilePath side_effect_free_whitelist_filename = |
| 1671 SideEffectFreeWhitelistDBFilename(filename_base_); | 1740 SideEffectFreeWhitelistDBFilename(filename_base_); |
| 1672 const bool r8 = base::DeleteFile(side_effect_free_whitelist_filename, | 1741 const bool r9 = base::DeleteFile(side_effect_free_whitelist_filename, |
| 1673 false); | 1742 false); |
| 1674 if (!r8) | 1743 if (!r9) |
| 1675 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_DELETE); | 1744 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_DELETE); |
| 1676 | 1745 |
| 1677 const base::FilePath side_effect_free_whitelist_prefix_set_filename = | 1746 const base::FilePath side_effect_free_whitelist_prefix_set_filename = |
| 1678 PrefixSetForFilename(side_effect_free_whitelist_filename); | 1747 PrefixSetForFilename(side_effect_free_whitelist_filename); |
| 1679 const bool r9 = base::DeleteFile( | 1748 const bool r10 = base::DeleteFile( |
| 1680 side_effect_free_whitelist_prefix_set_filename, | 1749 side_effect_free_whitelist_prefix_set_filename, |
| 1681 false); | 1750 false); |
| 1682 if (!r9) | 1751 if (!r10) |
| 1683 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_PREFIX_SET_DELETE); | 1752 RecordFailure(FAILURE_SIDE_EFFECT_FREE_WHITELIST_PREFIX_SET_DELETE); |
| 1684 | 1753 |
| 1685 const bool r10 = base::DeleteFile(IpBlacklistDBFilename(filename_base_), | 1754 const bool r11 = base::DeleteFile(IpBlacklistDBFilename(filename_base_), |
| 1686 false); | 1755 false); |
| 1687 if (!r10) | 1756 if (!r11) |
| 1688 RecordFailure(FAILURE_IP_BLACKLIST_DELETE); | 1757 RecordFailure(FAILURE_IP_BLACKLIST_DELETE); |
| 1689 | 1758 |
| 1690 const bool r11 = | 1759 const bool r12 = |
| 1691 base::DeleteFile(UnwantedSoftwareDBFilename(filename_base_), false); | 1760 base::DeleteFile(UnwantedSoftwareDBFilename(filename_base_), false); |
| 1692 if (!r11) | 1761 if (!r12) |
| 1693 RecordFailure(FAILURE_UNWANTED_SOFTWARE_PREFIX_SET_DELETE); | 1762 RecordFailure(FAILURE_UNWANTED_SOFTWARE_PREFIX_SET_DELETE); |
| 1694 | 1763 |
| 1695 return r1 && r2 && r3 && r4 && r5 && r6 && r7 && r8 && r9 && r10 && r11; | 1764 return r1 && r2 && r3 && r4 && r5 && r6 && r7 && r8 && r9 && r10 && r11 && |
| 1765 r12; |
| 1696 } | 1766 } |
| 1697 | 1767 |
| 1698 void SafeBrowsingDatabaseNew::WritePrefixSet(const base::FilePath& db_filename, | 1768 void SafeBrowsingDatabaseNew::WritePrefixSet(const base::FilePath& db_filename, |
| 1699 PrefixSetId prefix_set_id, | 1769 PrefixSetId prefix_set_id, |
| 1700 FailureType write_failure_type) { | 1770 FailureType write_failure_type) { |
| 1701 DCHECK(thread_checker_.CalledOnValidThread()); | 1771 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1702 | 1772 |
| 1703 // Do not grab the lock to avoid contention while writing to disk. This is | 1773 // Do not grab the lock to avoid contention while writing to disk. This is |
| 1704 // safe as only this thread can ever modify |state_manager_|'s prefix sets | 1774 // safe as only this thread can ever modify |state_manager_|'s prefix sets |
| 1705 // anyways. | 1775 // anyways. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 // Changes to histogram suffixes below need to be mirrored in the | 1906 // Changes to histogram suffixes below need to be mirrored in the |
| 1837 // SafeBrowsingLists suffix enum in histograms.xml. | 1907 // SafeBrowsingLists suffix enum in histograms.xml. |
| 1838 if (EndsWith(filename, kBrowseDBFile, true)) | 1908 if (EndsWith(filename, kBrowseDBFile, true)) |
| 1839 histogram_name.append(".Browse"); | 1909 histogram_name.append(".Browse"); |
| 1840 else if (EndsWith(filename, kDownloadDBFile, true)) | 1910 else if (EndsWith(filename, kDownloadDBFile, true)) |
| 1841 histogram_name.append(".Download"); | 1911 histogram_name.append(".Download"); |
| 1842 else if (EndsWith(filename, kCsdWhitelistDBFile, true)) | 1912 else if (EndsWith(filename, kCsdWhitelistDBFile, true)) |
| 1843 histogram_name.append(".CsdWhitelist"); | 1913 histogram_name.append(".CsdWhitelist"); |
| 1844 else if (EndsWith(filename, kDownloadWhitelistDBFile, true)) | 1914 else if (EndsWith(filename, kDownloadWhitelistDBFile, true)) |
| 1845 histogram_name.append(".DownloadWhitelist"); | 1915 histogram_name.append(".DownloadWhitelist"); |
| 1916 else if (EndsWith(filename, kInclusionWhitelistDBFile, true)) |
| 1917 histogram_name.append(".InclusionWhitelist"); |
| 1846 else if (EndsWith(filename, kExtensionBlacklistDBFile, true)) | 1918 else if (EndsWith(filename, kExtensionBlacklistDBFile, true)) |
| 1847 histogram_name.append(".ExtensionBlacklist"); | 1919 histogram_name.append(".ExtensionBlacklist"); |
| 1848 else if (EndsWith(filename, kSideEffectFreeWhitelistDBFile, true)) | 1920 else if (EndsWith(filename, kSideEffectFreeWhitelistDBFile, true)) |
| 1849 histogram_name.append(".SideEffectFreeWhitelist"); | 1921 histogram_name.append(".SideEffectFreeWhitelist"); |
| 1850 else if (EndsWith(filename, kIPBlacklistDBFile, true)) | 1922 else if (EndsWith(filename, kIPBlacklistDBFile, true)) |
| 1851 histogram_name.append(".IPBlacklist"); | 1923 histogram_name.append(".IPBlacklist"); |
| 1852 else if (EndsWith(filename, kUnwantedSoftwareDBFile, true)) | 1924 else if (EndsWith(filename, kUnwantedSoftwareDBFile, true)) |
| 1853 histogram_name.append(".UnwantedSoftware"); | 1925 histogram_name.append(".UnwantedSoftware"); |
| 1854 else | 1926 else |
| 1855 NOTREACHED(); // Add support for new lists above. | 1927 NOTREACHED(); // Add support for new lists above. |
| 1856 | 1928 |
| 1857 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro. | 1929 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro. |
| 1858 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( | 1930 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( |
| 1859 histogram_name, 1, 1000000, 50, | 1931 histogram_name, 1, 1000000, 50, |
| 1860 base::HistogramBase::kUmaTargetedHistogramFlag); | 1932 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 1861 | 1933 |
| 1862 histogram_pointer->Add(file_size_kilobytes); | 1934 histogram_pointer->Add(file_size_kilobytes); |
| 1863 } | 1935 } |
| OLD | NEW |