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

Side by Side Diff: chrome/browser/chromeos/drive/drive_download_handler.cc

Issue 12040095: chromeos: Rename DriveDownloadHandler::GetDrivePath() to GetTargetPath(), make it return full path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 7 years, 11 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/drive_download_handler.h" 5 #include "chrome/browser/chromeos/drive/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 "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // This may have been previously set if the default download folder is 136 // This may have been previously set if the default download folder is
137 // /drive, and the user has now changed the download target to a local 137 // /drive, and the user has now changed the download target to a local
138 // folder. 138 // folder.
139 download->SetUserData(&kDrivePathKey, NULL); 139 download->SetUserData(&kDrivePathKey, NULL);
140 download->SetDisplayName(drive_path); 140 download->SetDisplayName(drive_path);
141 // TODO(achuith): This is not quite right. 141 // TODO(achuith): This is not quite right.
142 download->SetIsTemporary(false); 142 download->SetIsTemporary(false);
143 } 143 }
144 } 144 }
145 145
146 FilePath DriveDownloadHandler::GetDrivePath(const DownloadItem* download) { 146 FilePath DriveDownloadHandler::GetTargetPath(const DownloadItem* download) {
147 const DriveUserData* data = GetDriveUserData(download); 147 const DriveUserData* data = GetDriveUserData(download);
148 // If data is NULL, we've somehow lost the drive path selected by the file 148 // If data is NULL, we've somehow lost the drive path selected by the file
149 // picker. 149 // picker.
150 DCHECK(data); 150 DCHECK(data);
151 return data ? util::ExtractDrivePath(data->file_path()) : FilePath(); 151 return data ? data->file_path() : FilePath();
152 } 152 }
153 153
154 bool DriveDownloadHandler::IsDriveDownload(const DownloadItem* download) { 154 bool DriveDownloadHandler::IsDriveDownload(const DownloadItem* download) {
155 // We use the existence of the DriveUserData object in download as a 155 // We use the existence of the DriveUserData object in download as a
156 // signal that this is a DriveDownload. 156 // signal that this is a DriveDownload.
157 return GetDriveUserData(download) != NULL; 157 return GetDriveUserData(download) != NULL;
158 } 158 }
159 159
160 void DriveDownloadHandler::OnDownloadUpdated( 160 void DriveDownloadHandler::OnDownloadUpdated(
161 DownloadManager* manager, DownloadItem* download) { 161 DownloadManager* manager, DownloadItem* download) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 callback); 224 callback);
225 } else { 225 } else {
226 LOG(WARNING) << "Failed to create directory, error = " << error; 226 LOG(WARNING) << "Failed to create directory, error = " << error;
227 callback.Run(FilePath()); 227 callback.Run(FilePath());
228 } 228 }
229 } 229 }
230 230
231 void DriveDownloadHandler::UploadDownloadItem(DownloadItem* download) { 231 void DriveDownloadHandler::UploadDownloadItem(DownloadItem* download) {
232 DCHECK(download->IsComplete()); 232 DCHECK(download->IsComplete());
233 file_write_helper_->PrepareWritableFileAndRun( 233 file_write_helper_->PrepareWritableFileAndRun(
234 GetDrivePath(download), 234 util::ExtractDrivePath(GetTargetPath(download)),
235 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); 235 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath()));
236 } 236 }
237 237
238 } // namespace drive 238 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_download_handler.h ('k') | chrome/browser/download/download_file_picker_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698