| 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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
| 13 #include "chrome/browser/download/download_item_model.h" | 13 #include "chrome/browser/download/download_item_model.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "content/public/browser/download_item.h" | 19 #include "content/public/browser/download_item.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/browser/web_contents_delegate.h" | 21 #include "content/public/browser/web_contents_delegate.h" |
| 22 | 22 |
| 23 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 24 #include "content/public/browser/android/download_controller_android.h" | 24 #include "chrome/browser/android/download/download_controller_base.h" |
| 25 #else | 25 #else |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chrome/browser/download/notification/download_notification_manager.h" | 31 #include "chrome/browser/download/notification/download_notification_manager.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 | 59 // GET downloads without authentication are delegated to the Android |
| 60 // DownloadManager. Chrome is responsible for the rest. See | 60 // DownloadManager. Chrome is responsible for the rest. See |
| 61 // InterceptDownloadResourceThrottle::ProcessDownloadRequest(). | 61 // InterceptDownloadResourceThrottle::ProcessDownloadRequest(). |
| 62 content::DownloadControllerAndroid::Get()->OnDownloadStarted(item); | 62 DownloadControllerBase::Get()->OnDownloadStarted(item); |
| 63 } | 63 } |
| 64 | 64 |
| 65 #else // OS_ANDROID | 65 #else // OS_ANDROID |
| 66 | 66 |
| 67 class DownloadShelfUIControllerDelegate | 67 class DownloadShelfUIControllerDelegate |
| 68 : public DownloadUIController::Delegate { | 68 : public DownloadUIController::Delegate { |
| 69 public: | 69 public: |
| 70 // |profile| is required to outlive DownloadShelfUIControllerDelegate. | 70 // |profile| is required to outlive DownloadShelfUIControllerDelegate. |
| 71 explicit DownloadShelfUIControllerDelegate(Profile* profile) | 71 explicit DownloadShelfUIControllerDelegate(Profile* profile) |
| 72 : profile_(profile) {} | 72 : profile_(profile) {} |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 #endif | 181 #endif |
| 182 | 182 |
| 183 if (item->GetState() == content::DownloadItem::CANCELLED) | 183 if (item->GetState() == content::DownloadItem::CANCELLED) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 DownloadItemModel(item).SetWasUINotified(true); | 186 DownloadItemModel(item).SetWasUINotified(true); |
| 187 delegate_->OnNewDownloadReady(item); | 187 delegate_->OnNewDownloadReady(item); |
| 188 } | 188 } |
| OLD | NEW |