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/download/download_test_file_activity_observer.h" | 5 #include "chrome/browser/download/download_test_file_activity_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 protected: | 52 protected: |
53 void PromptUserForDownloadPath( | 53 void PromptUserForDownloadPath( |
54 content::DownloadItem* item, | 54 content::DownloadItem* item, |
55 const base::FilePath& suggested_path, | 55 const base::FilePath& suggested_path, |
56 const FileSelectedCallback& callback) override { | 56 const FileSelectedCallback& callback) override { |
57 file_chooser_displayed_ = true; | 57 file_chooser_displayed_ = true; |
58 base::ThreadTaskRunnerHandle::Get()->PostTask( | 58 base::ThreadTaskRunnerHandle::Get()->PostTask( |
59 FROM_HERE, | 59 FROM_HERE, |
60 base::Bind(callback, (file_chooser_enabled_ ? suggested_path | 60 base::Bind(callback, (file_chooser_enabled_ ? suggested_path |
61 : base::FilePath()))); | 61 : base::FilePath()), |
| 62 false)); |
62 } | 63 } |
63 | 64 |
64 void OpenDownload(content::DownloadItem* item) override {} | 65 void OpenDownload(content::DownloadItem* item) override {} |
65 | 66 |
66 private: | 67 private: |
67 bool file_chooser_enabled_; | 68 bool file_chooser_enabled_; |
68 bool file_chooser_displayed_; | 69 bool file_chooser_displayed_; |
69 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_; | 70 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_; |
70 }; | 71 }; |
71 | 72 |
(...skipping 11 matching lines...) Expand all Loading... |
83 | 84 |
84 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) { | 85 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) { |
85 if (test_delegate_.get()) | 86 if (test_delegate_.get()) |
86 test_delegate_->EnableFileChooser(enable); | 87 test_delegate_->EnableFileChooser(enable); |
87 } | 88 } |
88 | 89 |
89 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() { | 90 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() { |
90 return test_delegate_.get() && | 91 return test_delegate_.get() && |
91 test_delegate_->TestAndResetDidShowFileChooser(); | 92 test_delegate_->TestAndResetDidShowFileChooser(); |
92 } | 93 } |
OLD | NEW |