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

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

Issue 23523022: Replace GetForProfile by Get{FileSystem,DriveAppRegistry,DriveService)ByProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
Index: chrome/browser/chromeos/drive/file_system_util.cc
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index e0eb4488f4e1cfcf8034bb42e1b896e52544b27f..26e70b4e43ddb32312885b6a70a92532f04d58f2 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -70,12 +70,6 @@ const base::FilePath& GetDriveMyDriveMountPointPath() {
return drive_mydrive_mount_path;
}
-FileSystemInterface* GetFileSystem(Profile* profile) {
- DriveIntegrationService* integration_service =
- DriveIntegrationServiceFactory::GetForProfile(profile);
- return integration_service ? integration_service->file_system() : NULL;
-}
-
std::string ReadStringFromGDocFile(const base::FilePath& file_path,
const std::string& key) {
const int64 kMaxGDocSize = 4096;
@@ -140,6 +134,17 @@ const base::FilePath& GetDriveMountPointPath() {
return drive_mount_path;
}
+FileSystemInterface* GetFileSystemByProfile(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ DriveIntegrationService* integration_service =
+ DriveIntegrationServiceFactory::GetForProfile(profile);
kinaba 2013/09/04 08:57:42 How about implementing (as an anonymous-namespace
hidehiko 2013/09/04 09:35:42 Done.
+ // TODO(hidehiko): GetForProfile will return DriveIntegrationService
+ // regardless of mounting state. Needs to check the mounting state
+ // later. crbug.com/284972.
+ return integration_service ? integration_service->file_system() : NULL;
+}
+
FileSystemInterface* GetFileSystemByProfileId(void* profile_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -148,7 +153,31 @@ FileSystemInterface* GetFileSystemByProfileId(void* profile_id) {
Profile* profile = reinterpret_cast<Profile*>(profile_id);
if (!g_browser_process->profile_manager()->IsValidProfile(profile))
return NULL;
- return GetFileSystem(profile);
+ return GetFileSystemByProfile(profile);
+}
+
+DriveAppRegistry* GetDriveAppRegistryByProfile(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ DriveIntegrationService* integration_service =
+ DriveIntegrationServiceFactory::GetForProfile(profile);
kinaba 2013/09/04 08:57:42 ditto
hidehiko 2013/09/04 09:35:42 Done.
+ // TODO(hidehiko): GetForProfile will return DriveIntegrationService
+ // regardless of mounting state. Needs to check the mounting state
+ // later. crbug.com/284972.
+ return integration_service ?
+ integration_service->drive_app_registry() :
+ NULL;
+}
+
+DriveServiceInterface* GetDriveServiceByProfile(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ DriveIntegrationService* integration_service =
+ DriveIntegrationServiceFactory::GetForProfile(profile);
kinaba 2013/09/04 08:57:42 ditto
hidehiko 2013/09/04 09:35:42 Done.
+ // TODO(hidehiko): GetForProfile will return DriveIntegrationService
+ // regardless of mounting state. Needs to check the mounting state
+ // later. crbug.com/284972.
+ return integration_service ? integration_service->drive_service() : NULL;
}
bool IsSpecialResourceId(const std::string& resource_id) {
@@ -192,7 +221,7 @@ void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) {
if (!IsUnderDriveMountPoint(path))
return;
- FileSystemInterface* file_system = GetFileSystem(profile);
+ FileSystemInterface* file_system = GetFileSystemByProfile(profile);
if (!file_system)
return;
@@ -319,7 +348,7 @@ void PrepareWritableFileAndRun(Profile* profile,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- FileSystemInterface* file_system = GetFileSystem(profile);
+ FileSystemInterface* file_system = GetFileSystemByProfile(profile);
if (!file_system || !IsUnderDriveMountPoint(path)) {
content::BrowserThread::GetBlockingPool()->PostTask(
FROM_HERE, base::Bind(callback, FILE_ERROR_FAILED, base::FilePath()));
@@ -338,7 +367,7 @@ void EnsureDirectoryExists(Profile* profile,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
if (IsUnderDriveMountPoint(directory)) {
- FileSystemInterface* file_system = GetFileSystem(profile);
+ FileSystemInterface* file_system = GetFileSystemByProfile(profile);
DCHECK(file_system);
file_system->CreateDirectory(
ExtractDrivePath(directory),
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.h ('k') | chrome/browser/chromeos/extensions/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698