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 #include "content/browser/download/save_item.h" | 5 #include "content/browser/download/save_item.h" |
6 | 6 |
7 #include "base/file_util.h" | |
8 #include "base/logging.h" | 7 #include "base/logging.h" |
9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
10 #include "content/browser/download/save_file.h" | 9 #include "content/browser/download/save_file.h" |
11 #include "content/browser/download/save_file_manager.h" | 10 #include "content/browser/download/save_file_manager.h" |
12 #include "content/browser/download/save_package.h" | 11 #include "content/browser/download/save_package.h" |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 | 14 |
16 // Constructor for SaveItem when creating each saving job. | 15 // Constructor for SaveItem when creating each saving job. |
17 SaveItem::SaveItem(const GURL& url, | 16 SaveItem::SaveItem(const GURL& url, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 114 |
116 // Rename the save item with new path. | 115 // Rename the save item with new path. |
117 void SaveItem::Rename(const base::FilePath& full_path) { | 116 void SaveItem::Rename(const base::FilePath& full_path) { |
118 DCHECK(!full_path.empty() && !has_final_name()); | 117 DCHECK(!full_path.empty() && !has_final_name()); |
119 full_path_ = full_path; | 118 full_path_ = full_path; |
120 file_name_ = full_path_.BaseName(); | 119 file_name_ = full_path_.BaseName(); |
121 has_final_name_ = true; | 120 has_final_name_ = true; |
122 } | 121 } |
123 | 122 |
124 void SaveItem::SetSaveId(int32 save_id) { | 123 void SaveItem::SetSaveId(int32 save_id) { |
125 DCHECK(save_id_ == -1); | 124 DCHECK_EQ(-1, save_id_); |
126 save_id_ = save_id; | 125 save_id_ = save_id; |
127 } | 126 } |
128 | 127 |
129 void SaveItem::SetTotalBytes(int64 total_bytes) { | 128 void SaveItem::SetTotalBytes(int64 total_bytes) { |
130 DCHECK(total_bytes_ == 0); | 129 DCHECK_EQ(0, total_bytes_); |
131 total_bytes_ = total_bytes; | 130 total_bytes_ = total_bytes; |
132 } | 131 } |
133 | 132 |
134 } // namespace content | 133 } // namespace content |
OLD | NEW |