| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 WebstoreInstaller::~WebstoreInstaller() { | 307 WebstoreInstaller::~WebstoreInstaller() { |
| 308 controller_ = NULL; | 308 controller_ = NULL; |
| 309 if (download_item_) { | 309 if (download_item_) { |
| 310 download_item_->RemoveObserver(this); | 310 download_item_->RemoveObserver(this); |
| 311 download_item_ = NULL; | 311 download_item_ = NULL; |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 void WebstoreInstaller::OnDownloadStarted( | 315 void WebstoreInstaller::OnDownloadStarted( |
| 316 DownloadItem* item, net::Error error) { | 316 DownloadItem* item, |
| 317 content::DownloadInterruptReason interrupt_reason) { |
| 317 if (!item) { | 318 if (!item) { |
| 318 DCHECK_NE(net::OK, error); | 319 DCHECK_NE(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 319 ReportFailure(net::ErrorToString(error), FAILURE_REASON_OTHER); | 320 ReportFailure(content::DownloadInterruptReasonToString(interrupt_reason), |
| 321 FAILURE_REASON_OTHER); |
| 320 return; | 322 return; |
| 321 } | 323 } |
| 322 | 324 |
| 323 DCHECK_EQ(net::OK, error); | 325 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 324 download_item_ = item; | 326 download_item_ = item; |
| 325 download_item_->AddObserver(this); | 327 download_item_->AddObserver(this); |
| 326 if (approval_) | 328 if (approval_) |
| 327 download_item_->SetUserData(kApprovalKey, approval_.release()); | 329 download_item_->SetUserData(kApprovalKey, approval_.release()); |
| 328 if (delegate_) | 330 if (delegate_) |
| 329 delegate_->OnExtensionDownloadStarted(id_, download_item_); | 331 delegate_->OnExtensionDownloadStarted(id_, download_item_); |
| 330 } | 332 } |
| 331 | 333 |
| 332 void WebstoreInstaller::OnDownloadUpdated(DownloadItem* download) { | 334 void WebstoreInstaller::OnDownloadUpdated(DownloadItem* download) { |
| 333 CHECK_EQ(download_item_, download); | 335 CHECK_EQ(download_item_, download); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 void WebstoreInstaller::ReportSuccess() { | 463 void WebstoreInstaller::ReportSuccess() { |
| 462 if (delegate_) { | 464 if (delegate_) { |
| 463 delegate_->OnExtensionInstallSuccess(id_); | 465 delegate_->OnExtensionInstallSuccess(id_); |
| 464 delegate_ = NULL; | 466 delegate_ = NULL; |
| 465 } | 467 } |
| 466 | 468 |
| 467 Release(); // Balanced in Start(). | 469 Release(); // Balanced in Start(). |
| 468 } | 470 } |
| 469 | 471 |
| 470 } // namespace extensions | 472 } // namespace extensions |
| OLD | NEW |