| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download/download_ui_controller.h" | 5 #include "chrome/browser/download/download_ui_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 void AndroidUIControllerDelegate::OnNewDownloadReady( | 51 void AndroidUIControllerDelegate::OnNewDownloadReady( |
| 52 content::DownloadItem* item) { | 52 content::DownloadItem* item) { |
| 53 // The Android DownloadController is only interested in IN_PROGRESS downloads. | 53 // The Android DownloadController is only interested in IN_PROGRESS downloads. |
| 54 // Ones which are INTERRUPTED etc. can't be handed over to the Android | 54 // Ones which are INTERRUPTED etc. can't be handed over to the Android |
| 55 // DownloadManager. | 55 // DownloadManager. |
| 56 if (item->GetState() != content::DownloadItem::IN_PROGRESS) | 56 if (item->GetState() != content::DownloadItem::IN_PROGRESS) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 // GET downloads without authentication are delegated to the Android | |
| 60 // DownloadManager. Chrome is responsible for the rest. See | |
| 61 // InterceptDownloadResourceThrottle::ProcessDownloadRequest(). | |
| 62 DownloadControllerBase::Get()->OnDownloadStarted(item); | 59 DownloadControllerBase::Get()->OnDownloadStarted(item); |
| 63 } | 60 } |
| 64 | 61 |
| 65 #else // OS_ANDROID | 62 #else // OS_ANDROID |
| 66 | 63 |
| 67 class DownloadShelfUIControllerDelegate | 64 class DownloadShelfUIControllerDelegate |
| 68 : public DownloadUIController::Delegate { | 65 : public DownloadUIController::Delegate { |
| 69 public: | 66 public: |
| 70 // |profile| is required to outlive DownloadShelfUIControllerDelegate. | 67 // |profile| is required to outlive DownloadShelfUIControllerDelegate. |
| 71 explicit DownloadShelfUIControllerDelegate(Profile* profile) | 68 explicit DownloadShelfUIControllerDelegate(Profile* profile) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 175 } |
| 179 } | 176 } |
| 180 #endif | 177 #endif |
| 181 | 178 |
| 182 if (item->GetState() == content::DownloadItem::CANCELLED) | 179 if (item->GetState() == content::DownloadItem::CANCELLED) |
| 183 return; | 180 return; |
| 184 | 181 |
| 185 DownloadItemModel(item).SetWasUINotified(true); | 182 DownloadItemModel(item).SetWasUINotified(true); |
| 186 delegate_->OnNewDownloadReady(item); | 183 delegate_->OnNewDownloadReady(item); |
| 187 } | 184 } |
| OLD | NEW |