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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
10 #include "chrome/browser/ui/browser_finder.h" | |
11 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
12 #include "content/public/browser/download_item.h" | 11 #include "content/public/browser/download_item.h" |
13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
15 | 14 |
16 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
17 #include "content/public/browser/android/download_controller_android.h" | 16 #include "content/public/browser/android/download_controller_android.h" |
18 #else | 17 #else |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/host_desktop.h" |
20 #endif | 21 #endif |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // DefaultUIControllerDelegate{Android,} is used when a DownloadUIController is | 25 // DefaultUIControllerDelegate{Android,} is used when a DownloadUIController is |
25 // constructed without specifying an explicit Delegate. | 26 // constructed without specifying an explicit Delegate. |
26 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
27 | 28 |
28 class DefaultUIControllerDelegateAndroid | 29 class DefaultUIControllerDelegateAndroid |
29 : public DownloadUIController::Delegate { | 30 : public DownloadUIController::Delegate { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (item_model.WasUINotified() || !item_model.ShouldNotifyUI()) | 127 if (item_model.WasUINotified() || !item_model.ShouldNotifyUI()) |
127 return; | 128 return; |
128 | 129 |
129 // Wait until the target path is determined. | 130 // Wait until the target path is determined. |
130 if (item->GetTargetFilePath().empty()) | 131 if (item->GetTargetFilePath().empty()) |
131 return; | 132 return; |
132 | 133 |
133 DownloadItemModel(item).SetWasUINotified(true); | 134 DownloadItemModel(item).SetWasUINotified(true); |
134 delegate_->OnNewDownloadReady(item); | 135 delegate_->OnNewDownloadReady(item); |
135 } | 136 } |
OLD | NEW |