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

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

Issue 3348010: Revert 58196 - GTTF: Clean up DownloadFileManager... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
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)
15 : BaseFile(info->save_info.file_path, 14 : BaseFile(info->save_info.file_path,
16 info->url, 15 info->url,
17 info->referrer_url, 16 info->referrer_url,
18 info->received_bytes,
19 info->save_info.file_stream), 17 info->save_info.file_stream),
20 id_(info->download_id), 18 id_(info->download_id),
21 child_id_(info->child_id), 19 child_id_(info->child_id),
22 request_id_(info->request_id), 20 request_id_(info->request_id) {
23 download_manager_(download_manager) {
24 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 21 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
25
26 } 22 }
27 23
28 DownloadFile::~DownloadFile() { 24 DownloadFile::~DownloadFile() {
29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 25 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
30 } 26 }
31 27
32 void DownloadFile::DeleteCrDownload() { 28 void DownloadFile::DeleteCrDownload() {
33 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
34 FilePath crdownload = download_util::GetCrDownloadPath(full_path_); 30 FilePath crdownload = download_util::GetCrDownloadPath(full_path_);
35 file_util::Delete(crdownload, false); 31 file_util::Delete(crdownload, false);
36 } 32 }
37 33
38 void DownloadFile::CancelDownloadRequest(ResourceDispatcherHost* rdh) { 34 void DownloadFile::CancelDownloadRequest(ResourceDispatcherHost* rdh) {
39 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
40 ChromeThread::PostTask( 36 ChromeThread::PostTask(
41 ChromeThread::IO, FROM_HERE, 37 ChromeThread::IO, FROM_HERE,
42 NewRunnableFunction(&download_util::CancelDownloadRequest, 38 NewRunnableFunction(&download_util::CancelDownloadRequest,
43 rdh, 39 rdh,
44 child_id_, 40 child_id_,
45 request_id_)); 41 request_id_));
46 } 42 }
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