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/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/files/file_util.h" | 8 #include "base/files/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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (!manager) | 239 if (!manager) |
240 return; | 240 return; |
241 DownloadItem* download = manager->GetDownload(id); | 241 DownloadItem* download = manager->GetDownload(id); |
242 if (!download) | 242 if (!download) |
243 return; | 243 return; |
244 download->Remove(); | 244 download->Remove(); |
245 } | 245 } |
246 | 246 |
247 void DownloadHandler::OnDownloadUpdated( | 247 void DownloadHandler::OnDownloadUpdated( |
248 DownloadManager* manager, DownloadItem* download) { | 248 DownloadManager* manager, DownloadItem* download) { |
249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 249 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
250 | 250 |
251 // Only accept downloads that have the Drive meta data associated with them. | 251 // Only accept downloads that have the Drive meta data associated with them. |
252 DriveUserData* data = GetDriveUserData(download); | 252 DriveUserData* data = GetDriveUserData(download); |
253 if (!drive_tmp_download_path_.IsParent(download->GetTargetFilePath()) || | 253 if (!drive_tmp_download_path_.IsParent(download->GetTargetFilePath()) || |
254 !data || | 254 !data || |
255 data->is_complete()) | 255 data->is_complete()) |
256 return; | 256 return; |
257 | 257 |
258 switch (download->GetState()) { | 258 switch (download->GetState()) { |
259 case DownloadItem::IN_PROGRESS: | 259 case DownloadItem::IN_PROGRESS: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 DownloadManager* DownloadHandler::GetDownloadManager(void* manager_id) { | 334 DownloadManager* DownloadHandler::GetDownloadManager(void* manager_id) { |
335 if (manager_id == notifier_->GetManager()) | 335 if (manager_id == notifier_->GetManager()) |
336 return notifier_->GetManager(); | 336 return notifier_->GetManager(); |
337 if (notifier_incognito_ && manager_id == notifier_incognito_->GetManager()) | 337 if (notifier_incognito_ && manager_id == notifier_incognito_->GetManager()) |
338 return notifier_incognito_->GetManager(); | 338 return notifier_incognito_->GetManager(); |
339 return NULL; | 339 return NULL; |
340 } | 340 } |
341 | 341 |
342 } // namespace drive | 342 } // namespace drive |
OLD | NEW |