| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 controller_->GetBrowserContext()->GetResourceContext(); | 553 controller_->GetBrowserContext()->GetResourceContext(); |
| 554 scoped_ptr<DownloadUrlParameters> params(new DownloadUrlParameters( | 554 scoped_ptr<DownloadUrlParameters> params(new DownloadUrlParameters( |
| 555 download_url_, | 555 download_url_, |
| 556 render_process_host_id, | 556 render_process_host_id, |
| 557 render_view_host_routing_id , | 557 render_view_host_routing_id , |
| 558 resource_context)); | 558 resource_context)); |
| 559 params->set_file_path(file); | 559 params->set_file_path(file); |
| 560 if (controller_->GetVisibleEntry()) | 560 if (controller_->GetVisibleEntry()) |
| 561 params->set_referrer( | 561 params->set_referrer( |
| 562 content::Referrer(controller_->GetVisibleEntry()->GetURL(), | 562 content::Referrer(controller_->GetVisibleEntry()->GetURL(), |
| 563 WebKit::WebReferrerPolicyDefault)); | 563 blink::WebReferrerPolicyDefault)); |
| 564 params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted, this)); | 564 params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted, this)); |
| 565 download_manager->DownloadUrl(params.Pass()); | 565 download_manager->DownloadUrl(params.Pass()); |
| 566 } | 566 } |
| 567 | 567 |
| 568 void WebstoreInstaller::ReportFailure(const std::string& error, | 568 void WebstoreInstaller::ReportFailure(const std::string& error, |
| 569 FailureReason reason) { | 569 FailureReason reason) { |
| 570 if (delegate_) { | 570 if (delegate_) { |
| 571 delegate_->OnExtensionInstallFailure(id_, error, reason); | 571 delegate_->OnExtensionInstallFailure(id_, error, reason); |
| 572 delegate_ = NULL; | 572 delegate_ = NULL; |
| 573 } | 573 } |
| 574 | 574 |
| 575 extensions::InstallTracker* tracker = | 575 extensions::InstallTracker* tracker = |
| 576 extensions::InstallTrackerFactory::GetForProfile(profile_); | 576 extensions::InstallTrackerFactory::GetForProfile(profile_); |
| 577 tracker->OnInstallFailure(id_); | 577 tracker->OnInstallFailure(id_); |
| 578 | 578 |
| 579 Release(); // Balanced in Start(). | 579 Release(); // Balanced in Start(). |
| 580 } | 580 } |
| 581 | 581 |
| 582 void WebstoreInstaller::ReportSuccess() { | 582 void WebstoreInstaller::ReportSuccess() { |
| 583 if (delegate_) { | 583 if (delegate_) { |
| 584 delegate_->OnExtensionInstallSuccess(id_); | 584 delegate_->OnExtensionInstallSuccess(id_); |
| 585 delegate_ = NULL; | 585 delegate_ = NULL; |
| 586 } | 586 } |
| 587 | 587 |
| 588 Release(); // Balanced in Start(). | 588 Release(); // Balanced in Start(). |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace extensions | 591 } // namespace extensions |
| OLD | NEW |