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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/browser/download/download_item_model.h" | 8 #include "chrome/browser/download/download_item_model.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 DefaultUIControllerDelegateAndroid() {} | 32 DefaultUIControllerDelegateAndroid() {} |
33 virtual ~DefaultUIControllerDelegateAndroid() {} | 33 virtual ~DefaultUIControllerDelegateAndroid() {} |
34 | 34 |
35 private: | 35 private: |
36 // DownloadUIController::Delegate | 36 // DownloadUIController::Delegate |
37 virtual void NotifyDownloadStarting(content::DownloadItem* item) OVERRIDE; | 37 virtual void NotifyDownloadStarting(content::DownloadItem* item) OVERRIDE; |
38 }; | 38 }; |
39 | 39 |
40 void DefaultUIControllerDelegateAndroid::NotifyDownloadStarting( | 40 void DefaultUIControllerDelegateAndroid::NotifyDownloadStarting( |
41 content::DownloadItem* item) { | 41 content::DownloadItem* item) { |
42 // GET downloads are delegated to the Android DownloadManager. Chrome is only | 42 // GET downloads without authentication are delegated to the Android |
43 // responsible for POST downloads. See | 43 // DownloadManager. Chrome is responsible for the rest. See |
44 // ChromeWebContentsDelegateAndroid::CanDownload(). | 44 // InterceptDownloadResourceThrottle::ProcessDownloadRequest(). |
45 content::DownloadControllerAndroid::Get()->OnPostDownloadStarted(item); | 45 content::DownloadControllerAndroid::Get()->OnDownloadStarted(item); |
46 } | 46 } |
47 | 47 |
48 #else // OS_ANDROID | 48 #else // OS_ANDROID |
49 | 49 |
50 class DefaultUIControllerDelegate : public DownloadUIController::Delegate { | 50 class DefaultUIControllerDelegate : public DownloadUIController::Delegate { |
51 public: | 51 public: |
52 // |profile| is required to outlive DefaultUIControllerDelegate. | 52 // |profile| is required to outlive DefaultUIControllerDelegate. |
53 explicit DefaultUIControllerDelegate(Profile* profile) | 53 explicit DefaultUIControllerDelegate(Profile* profile) |
54 : profile_(profile) {} | 54 : profile_(profile) {} |
55 virtual ~DefaultUIControllerDelegate() {} | 55 virtual ~DefaultUIControllerDelegate() {} |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (item->GetTargetFilePath().empty()) | 144 if (item->GetTargetFilePath().empty()) |
145 return; | 145 return; |
146 | 146 |
147 // Can't be complete. That would imply that we didn't receive an | 147 // Can't be complete. That would imply that we didn't receive an |
148 // OnDownloadUpdated() after the target was determined. | 148 // OnDownloadUpdated() after the target was determined. |
149 DCHECK(!item->IsComplete()); | 149 DCHECK(!item->IsComplete()); |
150 | 150 |
151 DownloadItemModel(item).SetShouldNotifyUI(false); | 151 DownloadItemModel(item).SetShouldNotifyUI(false); |
152 delegate_->NotifyDownloadStarting(item); | 152 delegate_->NotifyDownloadStarting(item); |
153 } | 153 } |
OLD | NEW |