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

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

Issue 2853363002: Rename the DownloadService to DownloadCoreService (Closed)
Patch Set: Created 3 years, 7 months 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"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "chrome/browser/download/chrome_download_manager_delegate.h" 13 #include "chrome/browser/download/chrome_download_manager_delegate.h"
14 #include "chrome/browser/download/download_service.h" 14 #include "chrome/browser/download/download_core_service.h"
15 #include "chrome/browser/download/download_service_factory.h" 15 #include "chrome/browser/download/download_core_service_factory.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 17
18 namespace content { 18 namespace content {
19 class DownloadItem; 19 class DownloadItem;
20 } 20 }
21 21
22 // Test ChromeDownloadManagerDelegate that controls whether how file chooser 22 // Test ChromeDownloadManagerDelegate that controls whether how file chooser
23 // dialogs are handled, and how files are opend. 23 // dialogs are handled, and how files are opend.
24 // By default, file chooser dialogs are disabled. 24 // By default, file chooser dialogs are disabled.
25 class DownloadTestFileActivityObserver::MockDownloadManagerDelegate 25 class DownloadTestFileActivityObserver::MockDownloadManagerDelegate
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 bool file_chooser_enabled_; 71 bool file_chooser_enabled_;
72 bool file_chooser_displayed_; 72 bool file_chooser_displayed_;
73 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_; 73 base::WeakPtrFactory<MockDownloadManagerDelegate> weak_ptr_factory_;
74 }; 74 };
75 75
76 DownloadTestFileActivityObserver::DownloadTestFileActivityObserver( 76 DownloadTestFileActivityObserver::DownloadTestFileActivityObserver(
77 Profile* profile) { 77 Profile* profile) {
78 std::unique_ptr<MockDownloadManagerDelegate> mock_delegate( 78 std::unique_ptr<MockDownloadManagerDelegate> mock_delegate(
79 new MockDownloadManagerDelegate(profile)); 79 new MockDownloadManagerDelegate(profile));
80 test_delegate_ = mock_delegate->GetWeakPtr(); 80 test_delegate_ = mock_delegate->GetWeakPtr();
81 DownloadServiceFactory::GetForBrowserContext(profile) 81 DownloadCoreServiceFactory::GetForBrowserContext(profile)
82 ->SetDownloadManagerDelegateForTesting(std::move(mock_delegate)); 82 ->SetDownloadManagerDelegateForTesting(std::move(mock_delegate));
83 } 83 }
84 84
85 DownloadTestFileActivityObserver::~DownloadTestFileActivityObserver() { 85 DownloadTestFileActivityObserver::~DownloadTestFileActivityObserver() {
86 } 86 }
87 87
88 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) { 88 void DownloadTestFileActivityObserver::EnableFileChooser(bool enable) {
89 if (test_delegate_.get()) 89 if (test_delegate_.get())
90 test_delegate_->EnableFileChooser(enable); 90 test_delegate_->EnableFileChooser(enable);
91 } 91 }
92 92
93 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() { 93 bool DownloadTestFileActivityObserver::TestAndResetDidShowFileChooser() {
94 return test_delegate_.get() && 94 return test_delegate_.get() &&
95 test_delegate_->TestAndResetDidShowFileChooser(); 95 test_delegate_->TestAndResetDidShowFileChooser();
96 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698