| Index: chrome/browser/download/download_file_picker_chromeos.cc
|
| ===================================================================
|
| --- chrome/browser/download/download_file_picker_chromeos.cc (revision 128869)
|
| +++ chrome/browser/download/download_file_picker_chromeos.cc (working copy)
|
| @@ -8,38 +8,20 @@
|
| #include "base/file_util.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/download_item.h"
|
| -#include "content/public/browser/download_manager.h"
|
| #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
|
| #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
|
| #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
|
| #include "chrome/browser/chromeos/gdata/gdata_util.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/download_item.h"
|
| +#include "content/public/browser/download_manager.h"
|
|
|
| using content::BrowserThread;
|
| using content::DownloadManager;
|
|
|
| namespace {
|
|
|
| -// Callbacks for PostTaskAndReply.
|
| -
|
| -// |temp_path| is set to a temporary local download path in
|
| -// ~/GCache/v1/tmp/downloads/
|
| -// Must be called on the FILE thread.
|
| -void GetGDataTempDownloadPath(const FilePath& download_cache_path,
|
| - FilePath* temp_path) {
|
| - if (!file_util::CreateDirectory(download_cache_path)) {
|
| - NOTREACHED();
|
| - LOG(ERROR) << "Can not create temp download directory at "
|
| - << download_cache_path.value();
|
| - }
|
| - bool created = file_util::CreateTemporaryFileInDir(download_cache_path,
|
| - temp_path);
|
| - // TODO(achuith): Handle failure in CreateTemporaryFileInDir.
|
| - DCHECK(created);
|
| -}
|
| -
|
| // Call FileSelected on |download_manager|.
|
| void GDataTempFileSelected(DownloadManager* download_manager,
|
| FilePath* file_path,
|
| @@ -82,19 +64,19 @@
|
| download->SetDisplayName(path.BaseName());
|
| download->SetIsTemporary(true);
|
|
|
| - const FilePath download_cache_path =
|
| + const FilePath gdata_tmp_download_dir =
|
| system_service->file_system()->GetGDataTempDownloadFolderPath();
|
|
|
| // Swap the gdata path with a local path. Local path must be created
|
| // on the IO thread pool.
|
| - FilePath* download_path(new FilePath());
|
| + FilePath* gdata_tmp_download_path(new FilePath());
|
| BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
|
| - base::Bind(&GetGDataTempDownloadPath,
|
| - download_cache_path,
|
| - download_path),
|
| + base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath,
|
| + gdata_tmp_download_dir,
|
| + gdata_tmp_download_path),
|
| base::Bind(&GDataTempFileSelected,
|
| download_manager_,
|
| - base::Owned(download_path),
|
| + base::Owned(gdata_tmp_download_path),
|
| download_id_));
|
| }
|
| } else {
|
|
|