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 "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 AndroidUIControllerDelegate() {} | 42 AndroidUIControllerDelegate() {} |
43 ~AndroidUIControllerDelegate() override {} | 43 ~AndroidUIControllerDelegate() override {} |
44 | 44 |
45 private: | 45 private: |
46 // DownloadUIController::Delegate | 46 // DownloadUIController::Delegate |
47 void OnNewDownloadReady(content::DownloadItem* item) override; | 47 void OnNewDownloadReady(content::DownloadItem* item) override; |
48 }; | 48 }; |
49 | 49 |
50 void AndroidUIControllerDelegate::OnNewDownloadReady( | 50 void AndroidUIControllerDelegate::OnNewDownloadReady( |
51 content::DownloadItem* item) { | 51 content::DownloadItem* item) { |
52 // The Android DownloadController is only interested in IN_PROGRESS downloads. | |
53 // Ones which are INTERRUPTED etc. can't be handed over to the Android | |
54 // DownloadManager. | |
55 if (item->GetState() != content::DownloadItem::IN_PROGRESS) | |
56 return; | |
57 | |
58 DownloadControllerBase::Get()->OnDownloadStarted(item); | 52 DownloadControllerBase::Get()->OnDownloadStarted(item); |
59 } | 53 } |
60 | 54 |
61 #else // OS_ANDROID | 55 #else // OS_ANDROID |
62 | 56 |
63 class DownloadShelfUIControllerDelegate | 57 class DownloadShelfUIControllerDelegate |
64 : public DownloadUIController::Delegate { | 58 : public DownloadUIController::Delegate { |
65 public: | 59 public: |
66 // |profile| is required to outlive DownloadShelfUIControllerDelegate. | 60 // |profile| is required to outlive DownloadShelfUIControllerDelegate. |
67 explicit DownloadShelfUIControllerDelegate(Profile* profile) | 61 explicit DownloadShelfUIControllerDelegate(Profile* profile) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 168 } |
175 } | 169 } |
176 #endif | 170 #endif |
177 | 171 |
178 if (item->GetState() == content::DownloadItem::CANCELLED) | 172 if (item->GetState() == content::DownloadItem::CANCELLED) |
179 return; | 173 return; |
180 | 174 |
181 DownloadItemModel(item).SetWasUINotified(true); | 175 DownloadItemModel(item).SetWasUINotified(true); |
182 delegate_->OnNewDownloadReady(item); | 176 delegate_->OnNewDownloadReady(item); |
183 } | 177 } |
OLD | NEW |