| Index: chrome/browser/chromeos/gdata/gdata_download_observer.cc
|
| diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.cc b/chrome/browser/chromeos/gdata/gdata_download_observer.cc
|
| index c6299d07349e4096619fb44ecbaf8a7108beb8e9..70d54a52ecf9ebc708c28e72ad32642f1fbdc321 100644
|
| --- a/chrome/browser/chromeos/gdata/gdata_download_observer.cc
|
| +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.cc
|
| @@ -58,7 +58,7 @@ class UploadingExternalData : public DownloadCompletionBlocker {
|
| };
|
|
|
| // External Data stored in DownloadItem for gdata path.
|
| -class GDataExternalData : public DownloadItem::ExternalData {
|
| +class GDataExternalData : public base::SupportsUserData::Data {
|
| public:
|
| explicit GDataExternalData(const FilePath& path) : file_path_(path) {}
|
| virtual ~GDataExternalData() {}
|
| @@ -72,13 +72,13 @@ class GDataExternalData : public DownloadItem::ExternalData {
|
| // Extracts UploadingExternalData* from |download|.
|
| UploadingExternalData* GetUploadingExternalData(DownloadItem* download) {
|
| return static_cast<UploadingExternalData*>(
|
| - download->GetExternalData(&kUploadingKey));
|
| + download->GetUserData(&kUploadingKey));
|
| }
|
|
|
| // Extracts GDataExternalData* from |download|.
|
| GDataExternalData* GetGDataExternalData(DownloadItem* download) {
|
| return static_cast<GDataExternalData*>(
|
| - download->GetExternalData(&kGDataPathKey));
|
| + download->GetUserData(&kGDataPathKey));
|
| }
|
|
|
| void RunSubstituteGDataDownloadCallback(
|
| @@ -233,15 +233,15 @@ void GDataDownloadObserver::SetDownloadParams(const FilePath& gdata_path,
|
| return;
|
|
|
| if (gdata::util::IsUnderGDataMountPoint(gdata_path)) {
|
| - download->SetExternalData(&kGDataPathKey,
|
| - new GDataExternalData(gdata_path));
|
| + download->SetUserData(&kGDataPathKey,
|
| + new GDataExternalData(gdata_path));
|
| download->SetDisplayName(gdata_path.BaseName());
|
| download->SetIsTemporary(true);
|
| } else if (IsGDataDownload(download)) {
|
| // This may have been previously set if the default download folder is
|
| // /drive, and the user has now changed the download target to a local
|
| // folder.
|
| - download->SetExternalData(&kGDataPathKey, NULL);
|
| + download->SetUserData(&kGDataPathKey, NULL);
|
| download->SetDisplayName(gdata_path);
|
| // TODO(achuith): This is not quite right.
|
| download->SetIsTemporary(false);
|
| @@ -363,7 +363,6 @@ void GDataDownloadObserver::OnDownloadUpdated(DownloadItem* download) {
|
|
|
| // TODO(achuith): Stop the pending upload and delete the file.
|
| case DownloadItem::CANCELLED:
|
| - case DownloadItem::REMOVING:
|
| case DownloadItem::INTERRUPTED:
|
| RemovePendingDownload(download);
|
| break;
|
| @@ -375,6 +374,10 @@ void GDataDownloadObserver::OnDownloadUpdated(DownloadItem* download) {
|
| DVLOG(1) << "Number of pending downloads=" << pending_downloads_.size();
|
| }
|
|
|
| +void GDataDownloadObserver::OnDownloadDestroyed(DownloadItem* download) {
|
| + RemovePendingDownload(download);
|
| +}
|
| +
|
| void GDataDownloadObserver::AddPendingDownload(DownloadItem* download) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -400,8 +403,8 @@ void GDataDownloadObserver::RemovePendingDownload(DownloadItem* download) {
|
| }
|
|
|
| void GDataDownloadObserver::DetachFromDownload(DownloadItem* download) {
|
| - download->SetExternalData(&kUploadingKey, NULL);
|
| - download->SetExternalData(&kGDataPathKey, NULL);
|
| + download->SetUserData(&kUploadingKey, NULL);
|
| + download->SetUserData(&kGDataPathKey, NULL);
|
| download->RemoveObserver(this);
|
| }
|
|
|
| @@ -413,7 +416,7 @@ void GDataDownloadObserver::UploadDownloadItem(DownloadItem* download) {
|
| return;
|
|
|
| // Initialize uploading external data.
|
| - download->SetExternalData(&kUploadingKey,
|
| + download->SetUserData(&kUploadingKey,
|
| new UploadingExternalData(gdata_uploader_));
|
|
|
| // Create UploadFileInfo structure for the download item.
|
|
|