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

Side by Side Diff: chrome/browser/chromeos/drive/download_handler.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/drive/download_handler.h" 5 #include "chrome/browser/chromeos/drive/download_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 weak_ptr_factory_(this) { 100 weak_ptr_factory_(this) {
101 } 101 }
102 102
103 DownloadHandler::~DownloadHandler() { 103 DownloadHandler::~DownloadHandler() {
104 } 104 }
105 105
106 // static 106 // static
107 DownloadHandler* DownloadHandler::GetForProfile(Profile* profile) { 107 DownloadHandler* DownloadHandler::GetForProfile(Profile* profile) {
108 DriveIntegrationService* integration_service = 108 DriveIntegrationService* integration_service =
109 DriveIntegrationServiceFactory::FindForProfile(profile); 109 DriveIntegrationServiceFactory::FindForProfile(profile);
110 // TODO(hidehiko): FindForProfile will return the instance even if Drive is
111 // disabled. Needs to check the state. crbug.com/284972.
110 return integration_service ? integration_service->download_handler() : NULL; 112 return integration_service ? integration_service->download_handler() : NULL;
111 } 113 }
112 114
113 void DownloadHandler::Initialize( 115 void DownloadHandler::Initialize(
114 DownloadManager* download_manager, 116 DownloadManager* download_manager,
115 const base::FilePath& drive_tmp_download_path) { 117 const base::FilePath& drive_tmp_download_path) {
116 DCHECK(!drive_tmp_download_path.empty()); 118 DCHECK(!drive_tmp_download_path.empty());
117 119
118 drive_tmp_download_path_ = drive_tmp_download_path; 120 drive_tmp_download_path_ = drive_tmp_download_path;
119 121
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 void DownloadHandler::UploadDownloadItem(DownloadItem* download) { 303 void DownloadHandler::UploadDownloadItem(DownloadItem* download) {
302 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); 304 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState());
303 WriteOnCacheFile( 305 WriteOnCacheFile(
304 file_system_, 306 file_system_,
305 util::ExtractDrivePath(GetTargetPath(download)), 307 util::ExtractDrivePath(GetTargetPath(download)),
306 download->GetMimeType(), 308 download->GetMimeType(),
307 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); 309 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath()));
308 } 310 }
309 311
310 } // namespace drive 312 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_system_util.h » ('j') | chrome/browser/chromeos/drive/file_system_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698