OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/shell_download_manager_delegate.h" | 5 #include "content/shell/shell_download_manager_delegate.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/download_manager.h" | 23 #include "content/public/browser/download_manager.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/browser/web_contents_view.h" | 25 #include "content/public/browser/web_contents_view.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 ShellDownloadManagerDelegate::ShellDownloadManagerDelegate() | 30 ShellDownloadManagerDelegate::ShellDownloadManagerDelegate() |
31 : download_manager_(NULL), | 31 : download_manager_(NULL), |
32 suppress_prompting_(false), | 32 suppress_prompting_(false) { |
33 last_download_db_handle_(DownloadItem::kUninitializedHandle) { | |
34 // Balanced in Shutdown(); | 33 // Balanced in Shutdown(); |
35 AddRef(); | 34 AddRef(); |
36 } | 35 } |
37 | 36 |
38 ShellDownloadManagerDelegate::~ShellDownloadManagerDelegate(){ | 37 ShellDownloadManagerDelegate::~ShellDownloadManagerDelegate(){ |
39 } | 38 } |
40 | 39 |
41 | 40 |
42 void ShellDownloadManagerDelegate::SetDownloadManager( | 41 void ShellDownloadManagerDelegate::SetDownloadManager( |
43 DownloadManager* download_manager) { | 42 DownloadManager* download_manager) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 174 } |
176 gtk_widget_destroy(dialog); | 175 gtk_widget_destroy(dialog); |
177 #else | 176 #else |
178 NOTIMPLEMENTED(); | 177 NOTIMPLEMENTED(); |
179 #endif | 178 #endif |
180 | 179 |
181 callback.Run(result, DownloadItem::TARGET_DISPOSITION_PROMPT, | 180 callback.Run(result, DownloadItem::TARGET_DISPOSITION_PROMPT, |
182 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); | 181 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); |
183 } | 182 } |
184 | 183 |
185 void ShellDownloadManagerDelegate::AddItemToPersistentStore( | |
186 DownloadItem* item) { | |
187 download_manager_->OnItemAddedToPersistentStore( | |
188 item->GetId(), --last_download_db_handle_); | |
189 } | |
190 | |
191 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( | 184 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( |
192 const FilePath& default_download_path) { | 185 const FilePath& default_download_path) { |
193 default_download_path_ = default_download_path; | 186 default_download_path_ = default_download_path; |
194 suppress_prompting_ = true; | 187 suppress_prompting_ = true; |
195 } | 188 } |
196 | 189 |
197 } // namespace content | 190 } // namespace content |
OLD | NEW |