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 // File method ordering: Methods in this file are in the same order as | 5 // File method ordering: Methods in this file are in the same order as |
6 // in download_item_impl.h, with the following exception: The public | 6 // in download_item_impl.h, with the following exception: The public |
7 // interface Start is placed in chronological order with the other | 7 // interface Start is placed in chronological order with the other |
8 // (private) routines that together define a DownloadItem's state | 8 // (private) routines that together define a DownloadItem's state |
9 // transitions as the download progresses. See "Download progression | 9 // transitions as the download progresses. See "Download progression |
10 // cascade" later in this file. | 10 // cascade" later in this file. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "net/base/net_util.h" | 54 #include "net/base/net_util.h" |
55 | 55 |
56 namespace content { | 56 namespace content { |
57 | 57 |
58 namespace { | 58 namespace { |
59 | 59 |
60 void DeleteDownloadedFile(const base::FilePath& path) { | 60 void DeleteDownloadedFile(const base::FilePath& path) { |
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
62 | 62 |
63 // Make sure we only delete files. | 63 // Make sure we only delete files. |
64 if (!file_util::DirectoryExists(path)) | 64 if (!base::DirectoryExists(path)) |
65 base::Delete(path, false); | 65 base::Delete(path, false); |
66 } | 66 } |
67 | 67 |
68 // Wrapper around DownloadFile::Detach and DownloadFile::Cancel that | 68 // Wrapper around DownloadFile::Detach and DownloadFile::Cancel that |
69 // takes ownership of the DownloadFile and hence implicitly destroys it | 69 // takes ownership of the DownloadFile and hence implicitly destroys it |
70 // at the end of the function. | 70 // at the end of the function. |
71 static base::FilePath DownloadFileDetach( | 71 static base::FilePath DownloadFileDetach( |
72 scoped_ptr<DownloadFile> download_file) { | 72 scoped_ptr<DownloadFile> download_file) { |
73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
74 base::FilePath full_path = download_file->FullPath(); | 74 base::FilePath full_path = download_file->FullPath(); |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 case RESUME_MODE_USER_CONTINUE: | 1681 case RESUME_MODE_USER_CONTINUE: |
1682 return "USER_CONTINUE"; | 1682 return "USER_CONTINUE"; |
1683 case RESUME_MODE_USER_RESTART: | 1683 case RESUME_MODE_USER_RESTART: |
1684 return "USER_RESTART"; | 1684 return "USER_RESTART"; |
1685 } | 1685 } |
1686 NOTREACHED() << "Unknown resume mode " << mode; | 1686 NOTREACHED() << "Unknown resume mode " << mode; |
1687 return "unknown"; | 1687 return "unknown"; |
1688 } | 1688 } |
1689 | 1689 |
1690 } // namespace content | 1690 } // namespace content |
OLD | NEW |