diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 03:03:16 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 03:03:16 +0000 |
commit | 9ec4be8fef87de672f9741ac85a921510ad9da20 (patch) | |
tree | e4b8ec06d939689a3109c710c7f35bda9c4fc724 /chrome/browser/chromeos/gdata/gdata_download_observer.cc | |
parent | 8d56affe747035f60bdaf34295b46eb3a79346b0 (diff) | |
download | chromium_src-9ec4be8fef87de672f9741ac85a921510ad9da20.zip chromium_src-9ec4be8fef87de672f9741ac85a921510ad9da20.tar.gz chromium_src-9ec4be8fef87de672f9741ac85a921510ad9da20.tar.bz2 |
GData save package support with MHTML.
* Introduce SavePackageFilePickerChromeOS, which derives from SavePackageFilePicker.
* For gdata targets, we save the selected path, create a temporary mhtml file using WebContents::GenerateMHTML, and call GDataFileSystem::TransferFile to transfer the file to gdata.
* For non-gdata targets, we just generate the mhtml file in place.
* DownloadObserver::GetGDataTempDownloadPath is a static helper method to create a temporary gdata download file, used by SavePackageFilePickerChromeOS and DownloadFilePickerChromeOS.
BUG=chromium-os:28210
TEST=Go to a web page, use Save As, or ctrl-s to save a page to docs.
TBR=rdsmith@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9809011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/gdata/gdata_download_observer.cc')
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_download_observer.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.cc b/chrome/browser/chromeos/gdata/gdata_download_observer.cc index f5cc19c..4f14a63 100644 --- a/chrome/browser/chromeos/gdata/gdata_download_observer.cc +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" +#include "base/file_util.h" #include "chrome/browser/chromeos/gdata/gdata_uploader.h" #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" @@ -153,6 +154,20 @@ int GDataDownloadObserver::PercentComplete(DownloadItem* download) { return -1; } +// |gdata_tmp_download_path| is set to a temporary local download path in +// ~/GCache/v1/tmp/downloads/ +// static +void GDataDownloadObserver::GetGDataTempDownloadPath( + const FilePath& gdata_tmp_download_dir, + FilePath* gdata_tmp_download_path) { + bool created = file_util::CreateDirectory(gdata_tmp_download_dir); + DCHECK(created) << "Can not create temp download directory at " + << gdata_tmp_download_dir.value(); + created = file_util::CreateTemporaryFileInDir(gdata_tmp_download_dir, + gdata_tmp_download_path); + DCHECK(created) << "Temporary download file creation failed"; +} + void GDataDownloadObserver::ManagerGoingDown( DownloadManager* download_manager) { download_manager->RemoveObserver(this); |