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

Unified Diff: chrome/browser/chromeos/drive/drive_download_observer.cc

Issue 11369019: chromeos: Stop exposing DriveDownloadObserver::GetDriveTempDownloadPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/drive_download_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_download_observer.cc
diff --git a/chrome/browser/chromeos/drive/drive_download_observer.cc b/chrome/browser/chromeos/drive/drive_download_observer.cc
index 000e5e96601694f96b9d5596be1b34bb767ebc08..56e84ac90c129720620ad2d866e3ea8521bb587f 100644
--- a/chrome/browser/chromeos/drive/drive_download_observer.cc
+++ b/chrome/browser/chromeos/drive/drive_download_observer.cc
@@ -91,8 +91,7 @@ class DriveUserData : public base::SupportsUserData::Data {
// Extracts UploadingUserData* from |download|.
UploadingUserData* GetUploadingUserData(DownloadItem* download) {
- return static_cast<UploadingUserData*>(
- download->GetUserData(&kUploadingKey));
+ return static_cast<UploadingUserData*>(download->GetUserData(&kUploadingKey));
}
const UploadingUserData* GetUploadingUserData(const DownloadItem* download) {
@@ -102,8 +101,7 @@ const UploadingUserData* GetUploadingUserData(const DownloadItem* download) {
// Extracts DriveUserData* from |download|.
DriveUserData* GetDriveUserData(DownloadItem* download) {
- return static_cast<DriveUserData*>(
- download->GetUserData(&kGDataPathKey));
+ return static_cast<DriveUserData*>(download->GetUserData(&kGDataPathKey));
}
const DriveUserData* GetDriveUserData(const DownloadItem* download) {
@@ -125,6 +123,19 @@ DriveSystemService* GetSystemService(Profile* profile) {
return system_service;
}
+// Creates a temporary file |drive_tmp_download_path| in
+// |drive_tmp_download_dir|. Must be called on a thread that allows file
+// operations.
+void GetDriveTempDownloadPath(const FilePath& drive_tmp_download_dir,
+ FilePath* drive_tmp_download_path) {
+ bool created = file_util::CreateDirectory(drive_tmp_download_dir);
+ DCHECK(created) << "Can not create temp download directory at "
+ << drive_tmp_download_dir.value();
+ created = file_util::CreateTemporaryFileInDir(drive_tmp_download_dir,
+ drive_tmp_download_path);
+ DCHECK(created) << "Temporary download file creation failed";
+}
+
// Substitutes virtual drive path for local temporary path.
void SubstituteDriveDownloadPathInternal(
Profile* profile,
@@ -140,7 +151,7 @@ void SubstituteDriveDownloadPathInternal(
FilePath* drive_tmp_download_path(new FilePath());
BrowserThread::GetBlockingPool()->PostTaskAndReply(
FROM_HERE,
- base::Bind(&DriveDownloadObserver::GetDriveTempDownloadPath,
+ base::Bind(&GetDriveTempDownloadPath,
drive_tmp_download_dir,
drive_tmp_download_path),
base::Bind(&RunSubstituteDriveDownloadCallback,
@@ -323,20 +334,6 @@ int DriveDownloadObserver::PercentComplete(const DownloadItem* download) {
return -1;
}
-// |drive_tmp_download_path| is set to a temporary local download path in
-// ~/GCache/v1/tmp/downloads/
-// static
-void DriveDownloadObserver::GetDriveTempDownloadPath(
- const FilePath& drive_tmp_download_dir,
- FilePath* drive_tmp_download_path) {
- bool created = file_util::CreateDirectory(drive_tmp_download_dir);
- DCHECK(created) << "Can not create temp download directory at "
- << drive_tmp_download_dir.value();
- created = file_util::CreateTemporaryFileInDir(drive_tmp_download_dir,
- drive_tmp_download_path);
- DCHECK(created) << "Temporary download file creation failed";
-}
-
void DriveDownloadObserver::ManagerGoingDown(
DownloadManager* download_manager) {
download_manager->RemoveObserver(this);
« no previous file with comments | « chrome/browser/chromeos/drive/drive_download_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698