OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 149 matching lines...) Loading... |
160 const GURL& current_page_url = tab_contents_->GetURL(); | 160 const GURL& current_page_url = tab_contents_->GetURL(); |
161 DCHECK(current_page_url.is_valid()); | 161 DCHECK(current_page_url.is_valid()); |
162 page_url_ = current_page_url; | 162 page_url_ = current_page_url; |
163 } | 163 } |
164 | 164 |
165 // This is for testing use. Set |finished_| as true because we don't want | 165 // This is for testing use. Set |finished_| as true because we don't want |
166 // method Cancel to be be called in destructor in test mode. | 166 // method Cancel to be be called in destructor in test mode. |
167 SavePackage::SavePackage(const FilePath& file_full_path, | 167 SavePackage::SavePackage(const FilePath& file_full_path, |
168 const FilePath& directory_full_path) | 168 const FilePath& directory_full_path) |
169 : file_manager_(NULL), | 169 : file_manager_(NULL), |
| 170 tab_contents_(NULL), |
170 download_(NULL), | 171 download_(NULL), |
171 saved_main_file_path_(file_full_path), | 172 saved_main_file_path_(file_full_path), |
172 saved_main_directory_path_(directory_full_path), | 173 saved_main_directory_path_(directory_full_path), |
173 finished_(true), | 174 finished_(true), |
174 user_canceled_(false), | 175 user_canceled_(false), |
175 disk_error_occurred_(false), | 176 disk_error_occurred_(false), |
176 save_type_(SAVE_TYPE_UNKNOWN), | 177 save_type_(SAVE_TYPE_UNKNOWN), |
177 all_save_items_count_(0), | 178 all_save_items_count_(0), |
| 179 wait_state_(INITIALIZE), |
178 tab_id_(0) { | 180 tab_id_(0) { |
179 DCHECK(!saved_main_file_path_.empty() && | 181 DCHECK(!saved_main_file_path_.empty() && |
180 saved_main_file_path_.value().length() <= kMaxFilePathLength); | 182 saved_main_file_path_.value().length() <= kMaxFilePathLength); |
181 DCHECK(!saved_main_directory_path_.empty() && | 183 DCHECK(!saved_main_directory_path_.empty() && |
182 saved_main_directory_path_.value().length() < kMaxFilePathLength); | 184 saved_main_directory_path_.value().length() < kMaxFilePathLength); |
183 } | 185 } |
184 | 186 |
185 SavePackage::~SavePackage() { | 187 SavePackage::~SavePackage() { |
186 // Stop receiving saving job's updates | 188 // Stop receiving saving job's updates |
187 if (!finished_ && !canceled()) { | 189 if (!finished_ && !canceled()) { |
(...skipping 1014 matching lines...) Loading... |
1202 int index, void* params) { | 1204 int index, void* params) { |
1203 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1205 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1204 ContinueSave(save_params, path, index); | 1206 ContinueSave(save_params, path, index); |
1205 delete save_params; | 1207 delete save_params; |
1206 } | 1208 } |
1207 | 1209 |
1208 void SavePackage::FileSelectionCanceled(void* params) { | 1210 void SavePackage::FileSelectionCanceled(void* params) { |
1209 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1211 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1210 delete save_params; | 1212 delete save_params; |
1211 } | 1213 } |
OLD | NEW |