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

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

Issue 3245005: GTTF: Clean up DownloadFileManager (Closed)
Patch Set: fixes Created 10 years, 3 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_file.h" 5 #include "chrome/browser/download/download_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/download/download_manager.h" 9 #include "chrome/browser/download/download_manager.h"
10 #include "chrome/browser/download/download_util.h" 10 #include "chrome/browser/download/download_util.h"
11 #include "chrome/browser/history/download_types.h" 11 #include "chrome/browser/history/download_types.h"
12 12
13 DownloadFile::DownloadFile(const DownloadCreateInfo* info) 13 DownloadFile::DownloadFile(const DownloadCreateInfo* info,
14 DownloadManager* download_manager)
14 : BaseFile(info->save_info.file_path, 15 : BaseFile(info->save_info.file_path,
15 info->url, 16 info->url,
16 info->referrer_url, 17 info->referrer_url,
18 info->received_bytes,
17 info->save_info.file_stream), 19 info->save_info.file_stream),
18 id_(info->download_id), 20 id_(info->download_id),
19 child_id_(info->child_id), 21 child_id_(info->child_id),
20 request_id_(info->request_id) { 22 request_id_(info->request_id),
23 download_manager_(download_manager) {
21 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 24 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
25
22 } 26 }
23 27
24 DownloadFile::~DownloadFile() { 28 DownloadFile::~DownloadFile() {
25 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
26 } 30 }
27 31
28 void DownloadFile::DeleteCrDownload() { 32 void DownloadFile::DeleteCrDownload() {
29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 33 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
30 FilePath crdownload = download_util::GetCrDownloadPath(full_path_); 34 FilePath crdownload = download_util::GetCrDownloadPath(full_path_);
31 file_util::Delete(crdownload, false); 35 file_util::Delete(crdownload, false);
32 } 36 }
33 37
34 void DownloadFile::CancelDownloadRequest(ResourceDispatcherHost* rdh) { 38 void DownloadFile::CancelDownloadRequest(ResourceDispatcherHost* rdh) {
35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 39 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
36 ChromeThread::PostTask( 40 ChromeThread::PostTask(
37 ChromeThread::IO, FROM_HERE, 41 ChromeThread::IO, FROM_HERE,
38 NewRunnableFunction(&download_util::CancelDownloadRequest, 42 NewRunnableFunction(&download_util::CancelDownloadRequest,
39 rdh, 43 rdh,
40 child_id_, 44 child_id_,
41 request_id_)); 45 request_id_));
42 } 46 }
47
48 void DownloadFile::OnDownloadManagerShutdown() {
49 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
50 download_manager_ = NULL;
51 }
52
53 DownloadManager* DownloadFile::GetDownloadManager() {
54 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
55 return download_manager_.get();
56 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file.h ('k') | chrome/browser/download/download_file_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698