| 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/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 DownloadSaveInfo save_info; | 208 DownloadSaveInfo save_info; |
| 209 save_info.file_path = file; | 209 save_info.file_path = file; |
| 210 | 210 |
| 211 // The download url for the given extension is contained in |download_url_|. | 211 // The download url for the given extension is contained in |download_url_|. |
| 212 // We will navigate the current tab to this url to start the download. The | 212 // We will navigate the current tab to this url to start the download. The |
| 213 // download system will then pass the crx to the CrxInstaller. | 213 // download system will then pass the crx to the CrxInstaller. |
| 214 download_util::RecordDownloadSource( | 214 download_util::RecordDownloadSource( |
| 215 download_util::INITIATED_BY_WEBSTORE_INSTALLER); | 215 download_util::INITIATED_BY_WEBSTORE_INSTALLER); |
| 216 profile_->GetDownloadManager()->DownloadUrl( | 216 profile_->GetDownloadManager()->DownloadUrl( |
| 217 download_url_, referrer, "", | 217 download_url_, referrer, "", |
| 218 false, -1, save_info, controller_->GetWebContents()); | 218 false, -1, save_info, controller_->GetWebContents(), |
| 219 content::DownloadManager::OnStartedCallback()); |
| 219 } | 220 } |
| 220 | 221 |
| 221 void WebstoreInstaller::ReportFailure(const std::string& error) { | 222 void WebstoreInstaller::ReportFailure(const std::string& error) { |
| 222 if (delegate_) | 223 if (delegate_) |
| 223 delegate_->OnExtensionInstallFailure(id_, error); | 224 delegate_->OnExtensionInstallFailure(id_, error); |
| 224 | 225 |
| 225 Release(); // Balanced in Start(). | 226 Release(); // Balanced in Start(). |
| 226 } | 227 } |
| 227 | 228 |
| 228 void WebstoreInstaller::ReportSuccess() { | 229 void WebstoreInstaller::ReportSuccess() { |
| 229 if (delegate_) | 230 if (delegate_) |
| 230 delegate_->OnExtensionInstallSuccess(id_); | 231 delegate_->OnExtensionInstallSuccess(id_); |
| 231 | 232 |
| 232 Release(); // Balanced in Start(). | 233 Release(); // Balanced in Start(). |
| 233 } | 234 } |
| OLD | NEW |