OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download/download_target_determiner.h" | 5 #include "chrome/browser/download/download_target_determiner.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // Assume that: | 585 // Assume that: |
586 // IsDangerousFile(VISITED_REFERRER) => IsDangerousFile(NO_VISITS_...) | 586 // IsDangerousFile(VISITED_REFERRER) => IsDangerousFile(NO_VISITS_...) |
587 // I.e. having visited a referrer only lowers a file's danger level. | 587 // I.e. having visited a referrer only lowers a file's danger level. |
588 if (IsDangerousFile(NO_VISITS_TO_REFERRER)) { | 588 if (IsDangerousFile(NO_VISITS_TO_REFERRER)) { |
589 // Only need to ping the history DB if the download would be considered safe | 589 // Only need to ping the history DB if the download would be considered safe |
590 // if there are prior visits and is considered dangerous otherwise. | 590 // if there are prior visits and is considered dangerous otherwise. |
591 if (!IsDangerousFile(VISITED_REFERRER)) { | 591 if (!IsDangerousFile(VISITED_REFERRER)) { |
592 // HistoryServiceFactory redirects incognito profiles to on-record | 592 // HistoryServiceFactory redirects incognito profiles to on-record |
593 // profiles. There's no history for on-record profiles in unit_tests. | 593 // profiles. There's no history for on-record profiles in unit_tests. |
594 HistoryService* history_service = HistoryServiceFactory::GetForProfile( | 594 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
595 GetProfile(), Profile::EXPLICIT_ACCESS); | 595 GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); |
596 | 596 |
597 if (history_service && download_->GetReferrerUrl().is_valid()) { | 597 if (history_service && download_->GetReferrerUrl().is_valid()) { |
598 history_service->GetVisibleVisitCountToHost( | 598 history_service->GetVisibleVisitCountToHost( |
599 download_->GetReferrerUrl(), | 599 download_->GetReferrerUrl(), |
600 base::Bind( | 600 base::Bind( |
601 &VisitCountsToVisitedBefore, | 601 &VisitCountsToVisitedBefore, |
602 base::Bind( | 602 base::Bind( |
603 &DownloadTargetDeterminer::CheckVisitedReferrerBeforeDone, | 603 &DownloadTargetDeterminer::CheckVisitedReferrerBeforeDone, |
604 weak_ptr_factory_.GetWeakPtr())), | 604 weak_ptr_factory_.GetWeakPtr())), |
605 &history_tracker_); | 605 &history_tracker_); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 const base::FilePath& suggested_path) { | 886 const base::FilePath& suggested_path) { |
887 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 887 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
888 } | 888 } |
889 | 889 |
890 #if defined(OS_WIN) | 890 #if defined(OS_WIN) |
891 // static | 891 // static |
892 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 892 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
893 return g_is_adobe_reader_up_to_date_; | 893 return g_is_adobe_reader_up_to_date_; |
894 } | 894 } |
895 #endif | 895 #endif |
OLD | NEW |