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

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

Issue 9809011: GData save package support with MHTML. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add comments and TODOs Created 8 years, 8 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
OLDNEW
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_package.h" 5 #include "content/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 // The TabContents which owns this SavePackage may have disappeared during 1266 // The TabContents which owns this SavePackage may have disappeared during
1267 // the UI->FILE->UI thread hop of 1267 // the UI->FILE->UI thread hop of
1268 // GetSaveInfo->CreateDirectoryOnFileThread->ContinueGetSaveInfo. 1268 // GetSaveInfo->CreateDirectoryOnFileThread->ContinueGetSaveInfo.
1269 if (!web_contents()) 1269 if (!web_contents())
1270 return; 1270 return;
1271 1271
1272 FilePath::StringType default_extension; 1272 FilePath::StringType default_extension;
1273 if (can_save_as_complete) 1273 if (can_save_as_complete)
1274 default_extension = kDefaultHtmlExtension; 1274 default_extension = kDefaultHtmlExtension;
1275 1275
1276 // On ChromeOS, OnPathPicked is not invoked; SavePackageFilePickerChromeOS
1277 // handles the the save.
1276 download_manager_->delegate()->ChooseSavePath( 1278 download_manager_->delegate()->ChooseSavePath(
1277 web_contents(), suggested_path, default_extension, can_save_as_complete, 1279 web_contents(), suggested_path, default_extension, can_save_as_complete,
1278 base::Bind(&SavePackage::OnPathPicked, AsWeakPtr())); 1280 base::Bind(&SavePackage::OnPathPicked, AsWeakPtr()));
1279 } 1281 }
1280 1282
1281 void SavePackage::OnPathPicked(const FilePath& final_name, 1283 void SavePackage::OnPathPicked(const FilePath& final_name,
1282 content::SavePageType type) { 1284 content::SavePageType type) {
1283 // Ensure the filename is safe. 1285 // Ensure the filename is safe.
1284 saved_main_file_path_ = final_name; 1286 saved_main_file_path_ = final_name;
1285 // TODO(asanka): This call may block on IO and shouldn't be made 1287 // TODO(asanka): This call may block on IO and shouldn't be made
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 StopObservation(); 1320 StopObservation();
1319 } 1321 }
1320 1322
1321 void SavePackage::FinalizeDownloadEntry() { 1323 void SavePackage::FinalizeDownloadEntry() {
1322 DCHECK(download_); 1324 DCHECK(download_);
1323 DCHECK(download_manager_); 1325 DCHECK(download_manager_);
1324 1326
1325 download_manager_->SavePageDownloadFinished(download_); 1327 download_manager_->SavePageDownloadFinished(download_);
1326 StopObservation(); 1328 StopObservation();
1327 } 1329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698