OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 DownloadFile::DownloadFile(const DownloadCreateInfo* info) | 58 DownloadFile::DownloadFile(const DownloadCreateInfo* info) |
59 : file_(NULL), | 59 : file_(NULL), |
60 source_url_(info->url), | 60 source_url_(info->url), |
61 referrer_url_(info->referrer_url), | 61 referrer_url_(info->referrer_url), |
62 id_(info->download_id), | 62 id_(info->download_id), |
63 child_id_(info->child_id), | 63 child_id_(info->child_id), |
64 render_view_id_(info->render_view_id), | 64 render_view_id_(info->render_view_id), |
65 request_id_(info->request_id), | 65 request_id_(info->request_id), |
66 bytes_so_far_(0), | 66 bytes_so_far_(0), |
67 path_renamed_(false), | 67 path_renamed_(false), |
68 in_progress_(true) { | 68 in_progress_(true), |
| 69 dont_sleep_(true) { |
69 } | 70 } |
70 | 71 |
71 DownloadFile::~DownloadFile() { | 72 DownloadFile::~DownloadFile() { |
72 Close(); | 73 Close(); |
73 } | 74 } |
74 | 75 |
75 bool DownloadFile::Initialize() { | 76 bool DownloadFile::Initialize() { |
76 if (file_util::CreateTemporaryFile(&full_path_)) | 77 if (file_util::CreateTemporaryFile(&full_path_)) |
77 return Open("wb"); | 78 return Open("wb"); |
78 return false; | 79 return false; |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 615 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
615 this, &DownloadFileManager::StopUpdateTimer)); | 616 this, &DownloadFileManager::StopUpdateTimer)); |
616 } | 617 } |
617 | 618 |
618 // static | 619 // static |
619 void DownloadFileManager::DeleteFile(const FilePath& path) { | 620 void DownloadFileManager::DeleteFile(const FilePath& path) { |
620 // Make sure we only delete files. | 621 // Make sure we only delete files. |
621 if (!file_util::DirectoryExists(path)) | 622 if (!file_util::DirectoryExists(path)) |
622 file_util::Delete(path, false); | 623 file_util::Delete(path, false); |
623 } | 624 } |
OLD | NEW |