| 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 "chrome/browser/ui/webui/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } else { | 190 } else { |
| 191 NOTREACHED() << "state undefined"; | 191 NOTREACHED() << "state undefined"; |
| 192 } | 192 } |
| 193 | 193 |
| 194 return file_value; | 194 return file_value; |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Filters out extension downloads and downloads that don't have a filename yet. | 197 // Filters out extension downloads and downloads that don't have a filename yet. |
| 198 bool IsDownloadDisplayable(const content::DownloadItem& item) { | 198 bool IsDownloadDisplayable(const content::DownloadItem& item) { |
| 199 return (!download_crx_util::IsExtensionDownload(item) && | 199 return (!download_crx_util::IsExtensionDownload(item) && |
| 200 item.IsPersisted() && | |
| 201 !item.IsTemporary() && | 200 !item.IsTemporary() && |
| 202 !item.GetFileNameToReportUser().empty() && | 201 !item.GetFileNameToReportUser().empty() && |
| 203 !item.GetTargetFilePath().empty()); | 202 !item.GetTargetFilePath().empty()); |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace | 205 } // namespace |
| 207 | 206 |
| 208 DownloadsDOMHandler::DownloadsDOMHandler(content::DownloadManager* dlm) | 207 DownloadsDOMHandler::DownloadsDOMHandler(content::DownloadManager* dlm) |
| 209 : search_text_(), | 208 : search_text_(), |
| 210 ALLOW_THIS_IN_INITIALIZER_LIST(main_notifier_(dlm, this)), | 209 ALLOW_THIS_IN_INITIALIZER_LIST(main_notifier_(dlm, this)), |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 501 } |
| 503 | 502 |
| 504 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 503 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 505 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 504 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 506 } | 505 } |
| 507 | 506 |
| 508 void DownloadsDOMHandler::CallDownloadUpdated( | 507 void DownloadsDOMHandler::CallDownloadUpdated( |
| 509 const base::ListValue& download_item) { | 508 const base::ListValue& download_item) { |
| 510 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 509 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 511 } | 510 } |
| OLD | NEW |