Reviewers: kinaba,
Message:
Please review
Description:
chromeos: Stop exposing DriveDownloadObserver::GetDriveTempDownloadPath
There is no need to make the function public static when it can live in the
nameless namespace.
BUG=None
TEST=build
Please review this at https://codereview.chromium.org/11369019/
SVN Base: svn://svn.chromium.org/chrome/trunk/src
Affected files:
M chrome/browser/chromeos/drive/drive_download_observer.h
M chrome/browser/chromeos/drive/drive_download_observer.cc
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..56e84ac90c129720620ad2d866e3ea852 1bb587f
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);
Index: chrome/browser/chromeos/drive/drive_download_observer.h
diff --git a/chrome/browser/chromeos/drive/drive_download_observer.h
b/chrome/browser/chromeos/drive/drive_download_observer.h
index
bba420a282a917f3fcbd0a3960607727530d7b3c..536e81d7d3e1b5a87908178ffa329cf76 c0ee43e
100644
--- a/chrome/browser/chromeos/drive/drive_download_observer.h
+++ b/chrome/browser/chromeos/drive/drive_download_observer.h
@@ -20,7 +20,6 @@ class Profile;
namespace google_apis {
class DocumentEntry;
-class DriveUploader;
}
namespace drive {
@@ -42,9 +41,11 @@ class DriveDownloadObserver : public
content::DownloadManager::Observer,
const FilePath& drive_tmp_download_path);
typedef base::Callback<void(const FilePath&)>
- SubstituteDriveDownloadPathCallback;
- static void SubstituteDriveDownloadPath(Profile* profile,
- const FilePath& drive_path, content::DownloadItem* download,
+ SubstituteDriveDownloadPathCallback;
+ static void SubstituteDriveDownloadPath(
+ Profile* profile,
+ const FilePath& drive_path,
+ content::DownloadItem* download,
const SubstituteDriveDownloadPathCallback& callback);
// Sets drive path, for example, '/special/drive/MyFolder/MyFile',
@@ -71,9 +72,8 @@ class DriveDownloadObserver : public
content::DownloadManager::Observer,
// becomes ready to complete. If this method is called multiple times
with
// the download not ready to complete, only the last |complete_callback|
// passed to this method for |download| will be called.
- static bool IsReadyToComplete(
- content::DownloadItem* download,
- const base::Closure& complete_callback);
+ static bool IsReadyToComplete(content::DownloadItem* download,
+ const base::Closure& complete_callback);
// Returns the count of bytes confirmed as uploaded so far for |
download|.
static int64 GetUploadedBytes(const content::DownloadItem* download);
@@ -82,12 +82,6 @@ class DriveDownloadObserver : public
content::DownloadManager::Observer,
// progress is unknown, returns -1.
static int PercentComplete(const content::DownloadItem* download);
- // Create a temporary file |drive_tmp_download_path| in
- // |drive_tmp_download_dir|. Must be called on a thread that allows file
- // operations.
- static void GetDriveTempDownloadPath(const FilePath&
drive_tmp_download_dir,
- FilePath* drive_tmp_download_path);
-
private:
// Structure containing arguments required to process uploading.
// For internal use, to avoid passing all of the parameters every time