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

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

Issue 23638007: Replace GetForProfile with drive::util::Get{DriveService,FileSystem}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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_task_executor.cc
diff --git a/chrome/browser/chromeos/drive/file_task_executor.cc b/chrome/browser/chromeos/drive/file_task_executor.cc
index c3c5874108870b22e48c3143b8d2ede5920db13b..6e60d68c9ff3e6b28f9fe353a860c8c0f3e563a2 100644
--- a/chrome/browser/chromeos/drive/file_task_executor.cc
+++ b/chrome/browser/chromeos/drive/file_task_executor.cc
@@ -37,6 +37,8 @@ FileTaskExecutor::~FileTaskExecutor() {
void FileTaskExecutor::Execute(
const std::vector<FileSystemURL>& file_urls,
const file_manager::file_tasks::FileTaskFinishedCallback& done) {
+ done_ = done;
+
std::vector<base::FilePath> paths;
for (size_t i = 0; i < file_urls.size(); ++i) {
base::FilePath path = util::ExtractDrivePathFromFileSystemUrl(file_urls[i]);
@@ -47,17 +49,14 @@ void FileTaskExecutor::Execute(
paths.push_back(path);
}
- DriveIntegrationService* integration_service =
- DriveIntegrationServiceFactory::GetForProfile(profile_);
- DCHECK_EQ(current_index_, 0);
- if (!integration_service || !integration_service->file_system()) {
+ FileSystemInterface* file_system = util::GetFileSystemByProfile(profile_);
+ if (!file_system) {
Done(false);
return;
}
- FileSystemInterface* file_system = integration_service->file_system();
- done_ = done;
// Reset the index, so we know when we're done.
+ DCHECK_EQ(current_index_, 0);
current_index_ = paths.size();
for (size_t i = 0; i < paths.size(); ++i) {
@@ -70,21 +69,18 @@ void FileTaskExecutor::Execute(
void FileTaskExecutor::OnFileEntryFetched(FileError error,
scoped_ptr<ResourceEntry> entry) {
- DriveIntegrationService* integration_service =
- DriveIntegrationServiceFactory::GetForProfile(profile_);
-
// Here, we are only interested in files.
if (entry.get() && !entry->has_file_specific_info())
error = FILE_ERROR_NOT_FOUND;
- if (!integration_service || error != FILE_ERROR_OK) {
+ DriveServiceInterface* drive_service =
+ util::GetDriveServiceByProfile(profile_);
+
+ if (!drive_service || error != FILE_ERROR_OK) {
Done(false);
return;
}
- DriveServiceInterface* drive_service =
- integration_service->drive_service();
-
// Send off a request for the drive service to authorize the apps for the
// current document entry for this document so we can get the
// open-with-<app_id> urls from the document entry.
@@ -100,15 +96,14 @@ void FileTaskExecutor::OnAppAuthorized(const std::string& resource_id,
const GURL& open_link) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ // TODO(hidehiko): GetForProfile will return the instance always even if
+ // Drive is disabled. Need to check the mounting state then.
+ // crbug.com/284972
DriveIntegrationService* integration_service =
DriveIntegrationServiceFactory::GetForProfile(profile_);
- if (!integration_service || error != google_apis::HTTP_SUCCESS) {
- Done(false);
- return;
- }
-
- if (open_link.is_empty()) {
+ if (!integration_service || error != google_apis::HTTP_SUCCESS ||
+ open_link.is_empty()) {
Done(false);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698