| 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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 std::string method_string = | 1058 std::string method_string = |
| 1059 downloads::ToString(options.method); | 1059 downloads::ToString(options.method); |
| 1060 if (!method_string.empty()) | 1060 if (!method_string.empty()) |
| 1061 download_params->set_method(method_string); | 1061 download_params->set_method(method_string); |
| 1062 if (options.body.get()) | 1062 if (options.body.get()) |
| 1063 download_params->set_post_body(*options.body.get()); | 1063 download_params->set_post_body(*options.body.get()); |
| 1064 download_params->set_callback(base::Bind( | 1064 download_params->set_callback(base::Bind( |
| 1065 &DownloadsDownloadFunction::OnStarted, this, | 1065 &DownloadsDownloadFunction::OnStarted, this, |
| 1066 creator_suggested_filename, options.conflict_action)); | 1066 creator_suggested_filename, options.conflict_action)); |
| 1067 // Prevent login prompts for 401/407 responses. | 1067 // Prevent login prompts for 401/407 responses. |
| 1068 download_params->set_load_flags(net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); | 1068 download_params->set_do_not_prompt_for_login(true); |
| 1069 | 1069 |
| 1070 DownloadManager* manager = BrowserContext::GetDownloadManager( | 1070 DownloadManager* manager = BrowserContext::GetDownloadManager( |
| 1071 current_profile); | 1071 current_profile); |
| 1072 manager->DownloadUrl(download_params.Pass()); | 1072 manager->DownloadUrl(download_params.Pass()); |
| 1073 RecordDownloadSource(DOWNLOAD_INITIATED_BY_EXTENSION); | 1073 RecordDownloadSource(DOWNLOAD_INITIATED_BY_EXTENSION); |
| 1074 RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); | 1074 RecordApiFunctions(DOWNLOADS_FUNCTION_DOWNLOAD); |
| 1075 return true; | 1075 return true; |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 void DownloadsDownloadFunction::OnStarted( | 1078 void DownloadsDownloadFunction::OnStarted( |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 const Extension* extension, | 1932 const Extension* extension, |
| 1933 UnloadedExtensionInfo::Reason reason) { | 1933 UnloadedExtensionInfo::Reason reason) { |
| 1934 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1934 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1935 std::set<const Extension*>::iterator iter = | 1935 std::set<const Extension*>::iterator iter = |
| 1936 shelf_disabling_extensions_.find(extension); | 1936 shelf_disabling_extensions_.find(extension); |
| 1937 if (iter != shelf_disabling_extensions_.end()) | 1937 if (iter != shelf_disabling_extensions_.end()) |
| 1938 shelf_disabling_extensions_.erase(iter); | 1938 shelf_disabling_extensions_.erase(iter); |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 } // namespace extensions | 1941 } // namespace extensions |
| OLD | NEW |