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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 3409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3420 : public content::DownloadTestObserver { | 3420 : public content::DownloadTestObserver { |
3421 public: | 3421 public: |
3422 explicit DisableSafeBrowsingOnInProgressDownload(Browser* browser) | 3422 explicit DisableSafeBrowsingOnInProgressDownload(Browser* browser) |
3423 : DownloadTestObserver(DownloadManagerForBrowser(browser), | 3423 : DownloadTestObserver(DownloadManagerForBrowser(browser), |
3424 1, | 3424 1, |
3425 ON_DANGEROUS_DOWNLOAD_QUIT), | 3425 ON_DANGEROUS_DOWNLOAD_QUIT), |
3426 browser_(browser), | 3426 browser_(browser), |
3427 final_state_seen_(false) { | 3427 final_state_seen_(false) { |
3428 Init(); | 3428 Init(); |
3429 } | 3429 } |
3430 virtual ~DisableSafeBrowsingOnInProgressDownload() {} | 3430 ~DisableSafeBrowsingOnInProgressDownload() override {} |
3431 | 3431 |
3432 virtual bool IsDownloadInFinalState(DownloadItem* download) override { | 3432 bool IsDownloadInFinalState(DownloadItem* download) override { |
3433 if (download->GetState() != DownloadItem::IN_PROGRESS || | 3433 if (download->GetState() != DownloadItem::IN_PROGRESS || |
3434 download->GetTargetFilePath().empty()) | 3434 download->GetTargetFilePath().empty()) |
3435 return false; | 3435 return false; |
3436 | 3436 |
3437 if (final_state_seen_) | 3437 if (final_state_seen_) |
3438 return true; | 3438 return true; |
3439 | 3439 |
3440 final_state_seen_ = true; | 3440 final_state_seen_ = true; |
3441 browser_->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, | 3441 browser_->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, |
3442 false); | 3442 false); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 *(downloads[0]))); | 3585 *(downloads[0]))); |
3586 | 3586 |
3587 // Begin feedback and check that the file is "stolen". | 3587 // Begin feedback and check that the file is "stolen". |
3588 download_protection_service->feedback_service()->BeginFeedbackForDownload( | 3588 download_protection_service->feedback_service()->BeginFeedbackForDownload( |
3589 downloads[0]); | 3589 downloads[0]); |
3590 std::vector<DownloadItem*> updated_downloads; | 3590 std::vector<DownloadItem*> updated_downloads; |
3591 GetDownloads(browser(), &updated_downloads); | 3591 GetDownloads(browser(), &updated_downloads); |
3592 ASSERT_TRUE(updated_downloads.empty()); | 3592 ASSERT_TRUE(updated_downloads.empty()); |
3593 } | 3593 } |
3594 #endif | 3594 #endif |
OLD | NEW |