Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Side by Side Diff: chrome/browser/download/save_package.cc

Issue 17032: * switch download manager to using FilePath... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, saved_main_file_path_, 0, page_url_, 180 download_ = new DownloadItem(1,
181 std::wstring(), Time::Now(), 0, -1, -1, false); 181 FilePath::FromWStringHack(saved_main_file_path_), 0, page_url_,
182 FilePath(), Time::Now(), 0, -1, -1, false);
182 download_->set_manager(web_contents_->profile()->GetDownloadManager()); 183 download_->set_manager(web_contents_->profile()->GetDownloadManager());
183 DownloadShelfView* shelf = web_contents_->GetDownloadShelfView(); 184 DownloadShelfView* shelf = web_contents_->GetDownloadShelfView();
184 shelf->AddDownloadView(new DownloadItemView( 185 shelf->AddDownloadView(new DownloadItemView(
185 download_, shelf, new SavePageModel(this, download_))); 186 download_, shelf, new SavePageModel(this, download_)));
186 web_contents_->SetDownloadShelfVisible(true); 187 web_contents_->SetDownloadShelfVisible(true);
187 188
188 // Check save type and process the save page job. 189 // Check save type and process the save page job.
189 if (save_type_ == SAVE_AS_COMPLETE_HTML) { 190 if (save_type_ == SAVE_AS_COMPLETE_HTML) {
190 // Get directory 191 // Get directory
191 DCHECK(!saved_main_directory_path_.empty()); 192 DCHECK(!saved_main_directory_path_.empty());
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1062
1062 if (available_length > dir_path_length) { 1063 if (available_length > dir_path_length) {
1063 *pure_file_name = 1064 *pure_file_name =
1064 pure_file_name->substr(0, available_length - dir_path_length); 1065 pure_file_name->substr(0, available_length - dir_path_length);
1065 return true; 1066 return true;
1066 } else { 1067 } else {
1067 pure_file_name->clear(); 1068 pure_file_name->clear();
1068 return false; 1069 return false;
1069 } 1070 }
1070 } 1071 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698