| OLD | NEW |
| 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/gdata/drive_download_observer.h" | 5 #include "chrome/browser/chromeos/gdata/drive_download_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 base::Bind(&SubstituteDriveDownloadPathInternal, | 239 base::Bind(&SubstituteDriveDownloadPathInternal, |
| 240 profile, callback))); | 240 profile, callback))); |
| 241 } else { | 241 } else { |
| 242 callback.Run(drive_path); | 242 callback.Run(drive_path); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 // static | 246 // static |
| 247 void DriveDownloadObserver::SetDownloadParams(const FilePath& drive_path, | 247 void DriveDownloadObserver::SetDownloadParams(const FilePath& drive_path, |
| 248 DownloadItem* download) { | 248 DownloadItem* download) { |
| 249 if (!download) | 249 if (!download || (download->GetState() != DownloadItem::IN_PROGRESS)) |
| 250 return; | 250 return; |
| 251 | 251 |
| 252 if (util::IsUnderDriveMountPoint(drive_path)) { | 252 if (util::IsUnderDriveMountPoint(drive_path)) { |
| 253 download->SetUserData(&kGDataPathKey, | 253 download->SetUserData(&kGDataPathKey, |
| 254 new DriveUserData(drive_path)); | 254 new DriveUserData(drive_path)); |
| 255 download->SetDisplayName(drive_path.BaseName()); | 255 download->SetDisplayName(drive_path.BaseName()); |
| 256 download->SetIsTemporary(true); | 256 download->SetIsTemporary(true); |
| 257 } else if (IsDriveDownload(download)) { | 257 } else if (IsDriveDownload(download)) { |
| 258 // This may have been previously set if the default download folder is | 258 // This may have been previously set if the default download folder is |
| 259 // /drive, and the user has now changed the download target to a local | 259 // /drive, and the user has now changed the download target to a local |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 "], file_path=[" + file_path.value() + | 729 "], file_path=[" + file_path.value() + |
| 730 "], content_type=[" + content_type + | 730 "], content_type=[" + content_type + |
| 731 "], content_length=[" + base::UintToString(content_length) + | 731 "], content_length=[" + base::UintToString(content_length) + |
| 732 "], upload_location=[" + upload_location.possibly_invalid_spec() + | 732 "], upload_location=[" + upload_location.possibly_invalid_spec() + |
| 733 "], drive_path=[" + drive_path.value() + | 733 "], drive_path=[" + drive_path.value() + |
| 734 "], all_bytes_present=[" + (all_bytes_present ? "true" : "false") + | 734 "], all_bytes_present=[" + (all_bytes_present ? "true" : "false") + |
| 735 "]"; | 735 "]"; |
| 736 } | 736 } |
| 737 | 737 |
| 738 } // namespace gdata | 738 } // namespace gdata |
| OLD | NEW |