| 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 <set> |     7 #include <set> | 
|     8 #include <string> |     8 #include <string> | 
|     9  |     9  | 
|    10 #include "base/basictypes.h" |    10 #include "base/basictypes.h" | 
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1005   std::string method_string = |  1005   std::string method_string = | 
|  1006       downloads::ToString(options.method); |  1006       downloads::ToString(options.method); | 
|  1007   if (!method_string.empty()) |  1007   if (!method_string.empty()) | 
|  1008     download_params->set_method(method_string); |  1008     download_params->set_method(method_string); | 
|  1009   if (options.body.get()) |  1009   if (options.body.get()) | 
|  1010     download_params->set_post_body(*options.body.get()); |  1010     download_params->set_post_body(*options.body.get()); | 
|  1011   download_params->set_callback(base::Bind( |  1011   download_params->set_callback(base::Bind( | 
|  1012       &DownloadsDownloadFunction::OnStarted, this, |  1012       &DownloadsDownloadFunction::OnStarted, this, | 
|  1013       creator_suggested_filename, options.conflict_action)); |  1013       creator_suggested_filename, options.conflict_action)); | 
|  1014   // Prevent login prompts for 401/407 responses. |  1014   // Prevent login prompts for 401/407 responses. | 
|  1015   download_params->set_load_flags(net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); |  1015   download_params->set_do_not_prompt_for_login(true); | 
|  1016  |  1016  | 
|  1017   DownloadManager* manager = BrowserContext::GetDownloadManager( |  1017   DownloadManager* manager = BrowserContext::GetDownloadManager( | 
|  1018       current_profile); |  1018       current_profile); | 
|  1019   manager->DownloadUrl(download_params.Pass()); |  1019   manager->DownloadUrl(download_params.Pass()); | 
|  1020   RecordDownloadSource(DOWNLOAD_INITIATED_BY_EXTENSION); |  1020   RecordDownloadSource(DOWNLOAD_INITIATED_BY_EXTENSION); | 
|  1021   RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); |  1021   RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); | 
|  1022   return true; |  1022   return true; | 
|  1023 } |  1023 } | 
|  1024  |  1024  | 
|  1025 void DownloadsDownloadFunction::OnStarted( |  1025 void DownloadsDownloadFunction::OnStarted( | 
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1900     return; |  1900     return; | 
|  1901   base::Time now(base::Time::Now()); |  1901   base::Time now(base::Time::Now()); | 
|  1902   int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); |  1902   int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); | 
|  1903   if (delta <= kFileExistenceRateLimitSeconds) |  1903   if (delta <= kFileExistenceRateLimitSeconds) | 
|  1904     return; |  1904     return; | 
|  1905   last_checked_removal_ = now; |  1905   last_checked_removal_ = now; | 
|  1906   manager->CheckForHistoryFilesRemoval(); |  1906   manager->CheckForHistoryFilesRemoval(); | 
|  1907 } |  1907 } | 
|  1908  |  1908  | 
|  1909 }  // namespace extensions |  1909 }  // namespace extensions | 
| OLD | NEW |