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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return false; | 170 return false; |
171 } | 171 } |
172 | 172 |
173 file_manager_ = rdh->save_file_manager(); | 173 file_manager_ = rdh->save_file_manager(); |
174 if (!file_manager_) { | 174 if (!file_manager_) { |
175 NOTREACHED(); | 175 NOTREACHED(); |
176 return false; | 176 return false; |
177 } | 177 } |
178 | 178 |
179 // Create the fake DownloadItem and display the view. | 179 // Create the fake DownloadItem and display the view. |
180 download_ = new DownloadItem(1, | 180 download_ = new DownloadItem(1, saved_main_file_path_, 0, page_url_, |
181 FilePath::FromWStringHack(saved_main_file_path_), 0, page_url_, | 181 std::wstring(), Time::Now(), 0, -1, -1, false); |
182 FilePath(), Time::Now(), 0, -1, -1, false); | |
183 download_->set_manager(web_contents_->profile()->GetDownloadManager()); | 182 download_->set_manager(web_contents_->profile()->GetDownloadManager()); |
184 DownloadShelfView* shelf = web_contents_->GetDownloadShelfView(); | 183 DownloadShelfView* shelf = web_contents_->GetDownloadShelfView(); |
185 shelf->AddDownloadView(new DownloadItemView( | 184 shelf->AddDownloadView(new DownloadItemView( |
186 download_, shelf, new SavePageModel(this, download_))); | 185 download_, shelf, new SavePageModel(this, download_))); |
187 web_contents_->SetDownloadShelfVisible(true); | 186 web_contents_->SetDownloadShelfVisible(true); |
188 | 187 |
189 // Check save type and process the save page job. | 188 // Check save type and process the save page job. |
190 if (save_type_ == SAVE_AS_COMPLETE_HTML) { | 189 if (save_type_ == SAVE_AS_COMPLETE_HTML) { |
191 // Get directory | 190 // Get directory |
192 DCHECK(!saved_main_directory_path_.empty()); | 191 DCHECK(!saved_main_directory_path_.empty()); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 | 1061 |
1063 if (available_length > dir_path_length) { | 1062 if (available_length > dir_path_length) { |
1064 *pure_file_name = | 1063 *pure_file_name = |
1065 pure_file_name->substr(0, available_length - dir_path_length); | 1064 pure_file_name->substr(0, available_length - dir_path_length); |
1066 return true; | 1065 return true; |
1067 } else { | 1066 } else { |
1068 pure_file_name->clear(); | 1067 pure_file_name->clear(); |
1069 return false; | 1068 return false; |
1070 } | 1069 } |
1071 } | 1070 } |
OLD | NEW |