Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: chrome/browser/download/download_test_file_activity_observer.cc

Issue 2453633006: [downloads] Move platform specific code out of DownloadTargetDeterminer. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool did_show = file_chooser_displayed_; 45 bool did_show = file_chooser_displayed_;
46 file_chooser_displayed_ = false; 46 file_chooser_displayed_ = false;
47 return did_show; 47 return did_show;
48 } 48 }
49 49
50 base::WeakPtr<MockDownloadManagerDelegate> GetWeakPtr() { 50 base::WeakPtr<MockDownloadManagerDelegate> GetWeakPtr() {
51 return weak_ptr_factory_.GetWeakPtr(); 51 return weak_ptr_factory_.GetWeakPtr();
52 } 52 }
53 53
54 protected: 54 protected:
55 void PromptUserForDownloadPath( 55 void RequestConfirmation(content::DownloadItem* item,
56 content::DownloadItem* item, 56 const base::FilePath& suggested_path,
57 const base::FilePath& suggested_path, 57 DownloadConfirmationReason reason,
58 const FileSelectedCallback& callback) override { 58 const FileSelectedCallback& callback) override {
59 file_chooser_displayed_ = true; 59 file_chooser_displayed_ = true;
60 base::ThreadTaskRunnerHandle::Get()->PostTask( 60 base::ThreadTaskRunnerHandle::Get()->PostTask(
61 FROM_HERE, 61 FROM_HERE,
62 base::Bind(callback, (file_chooser_enabled_ ? suggested_path 62 base::Bind(callback, (file_chooser_enabled_
63 : base::FilePath()))); 63 ? DownloadConfirmationResult::CONFIRMED
64 : DownloadConfirmationResult::CANCELED),
65 suggested_path));
64 } 66 }
65 67
66 void OpenDownload(content::DownloadItem* item) override {} 68 void OpenDownload(content::DownloadItem* item) override {}
67 69
68 private: 70 private:
69 bool file_chooser_enabled_; 71 bool file_chooser_enabled_;
70 bool file_chooser_displayed_; 72 bool file_chooser_displayed_;
71 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_; 73 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_;
72 }; 74 };
73 75
(...skipping 11 matching lines...) Expand all
85 87
86 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) { 88 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) {
87 if (test_delegate_.get()) 89 if (test_delegate_.get())
88 test_delegate_->EnableFileChooser(enable); 90 test_delegate_->EnableFileChooser(enable);
89 } 91 }
90 92
91 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() { 93 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() {
92 return test_delegate_.get() && 94 return test_delegate_.get() &&
93 test_delegate_->TestAndResetDidShowFileChooser(); 95 test_delegate_->TestAndResetDidShowFileChooser();
94 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698