| 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/extensions/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); | 1038 RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); |
| 1039 return true; | 1039 return true; |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 void DownloadsDownloadFunction::OnStarted( | 1042 void DownloadsDownloadFunction::OnStarted( |
| 1043 const base::FilePath& creator_suggested_filename, | 1043 const base::FilePath& creator_suggested_filename, |
| 1044 downloads::FilenameConflictAction creator_conflict_action, | 1044 downloads::FilenameConflictAction creator_conflict_action, |
| 1045 DownloadItem* item, | 1045 DownloadItem* item, |
| 1046 content::DownloadInterruptReason interrupt_reason) { | 1046 content::DownloadInterruptReason interrupt_reason) { |
| 1047 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1047 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1048 VLOG(1) << __FUNCTION__ << " " << item << " " << interrupt_reason; | 1048 VLOG(1) << __func__ << " " << item << " " << interrupt_reason; |
| 1049 if (item) { | 1049 if (item) { |
| 1050 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 1050 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 1051 SetResult(base::MakeUnique<base::FundamentalValue>( | 1051 SetResult(base::MakeUnique<base::FundamentalValue>( |
| 1052 static_cast<int>(item->GetId()))); | 1052 static_cast<int>(item->GetId()))); |
| 1053 if (!creator_suggested_filename.empty() || | 1053 if (!creator_suggested_filename.empty() || |
| 1054 (creator_conflict_action != | 1054 (creator_conflict_action != |
| 1055 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) { | 1055 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) { |
| 1056 ExtensionDownloadsEventRouterData* data = | 1056 ExtensionDownloadsEventRouterData* data = |
| 1057 ExtensionDownloadsEventRouterData::Get(item); | 1057 ExtensionDownloadsEventRouterData::Get(item); |
| 1058 if (!data) { | 1058 if (!data) { |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 return; | 1911 return; |
| 1912 base::Time now(base::Time::Now()); | 1912 base::Time now(base::Time::Now()); |
| 1913 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); | 1913 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); |
| 1914 if (delta <= kFileExistenceRateLimitSeconds) | 1914 if (delta <= kFileExistenceRateLimitSeconds) |
| 1915 return; | 1915 return; |
| 1916 last_checked_removal_ = now; | 1916 last_checked_removal_ = now; |
| 1917 manager->CheckForHistoryFilesRemoval(); | 1917 manager->CheckForHistoryFilesRemoval(); |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 } // namespace extensions | 1920 } // namespace extensions |
| OLD | NEW |