| 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/plugins/plugin_installer.h" | 5 #include "chrome/browser/plugins/plugin_installer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 void PluginInstaller::StartInstallingWithDownloadManager( | 99 void PluginInstaller::StartInstallingWithDownloadManager( |
| 100 const GURL& plugin_url, | 100 const GURL& plugin_url, |
| 101 content::WebContents* web_contents, | 101 content::WebContents* web_contents, |
| 102 content::DownloadManager* download_manager) { | 102 content::DownloadManager* download_manager) { |
| 103 DCHECK_EQ(INSTALLER_STATE_IDLE, state_); | 103 DCHECK_EQ(INSTALLER_STATE_IDLE, state_); |
| 104 state_ = INSTALLER_STATE_DOWNLOADING; | 104 state_ = INSTALLER_STATE_DOWNLOADING; |
| 105 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted()); | 105 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted()); |
| 106 std::unique_ptr<content::DownloadUrlParameters> download_parameters( | 106 std::unique_ptr<content::DownloadUrlParameters> download_parameters( |
| 107 content::DownloadUrlParameters::FromWebContents(web_contents, | 107 content::DownloadUrlParameters::CreateForWebContentsMainFrame( |
| 108 plugin_url)); | 108 web_contents, plugin_url)); |
| 109 download_parameters->set_callback( | 109 download_parameters->set_callback( |
| 110 base::Bind(&PluginInstaller::DownloadStarted, base::Unretained(this))); | 110 base::Bind(&PluginInstaller::DownloadStarted, base::Unretained(this))); |
| 111 RecordDownloadSource(DOWNLOAD_INITIATED_BY_PLUGIN_INSTALLER); | 111 RecordDownloadSource(DOWNLOAD_INITIATED_BY_PLUGIN_INSTALLER); |
| 112 download_manager->DownloadUrl(std::move(download_parameters)); | 112 download_manager->DownloadUrl(std::move(download_parameters)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void PluginInstaller::DownloadStarted( | 115 void PluginInstaller::DownloadStarted( |
| 116 content::DownloadItem* item, | 116 content::DownloadItem* item, |
| 117 content::DownloadInterruptReason interrupt_reason) { | 117 content::DownloadInterruptReason interrupt_reason) { |
| 118 if (interrupt_reason != content::DOWNLOAD_INTERRUPT_REASON_NONE) { | 118 if (interrupt_reason != content::DOWNLOAD_INTERRUPT_REASON_NONE) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 142 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); | 142 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); |
| 143 state_ = INSTALLER_STATE_IDLE; | 143 state_ = INSTALLER_STATE_IDLE; |
| 144 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); | 144 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void PluginInstaller::DownloadCancelled() { | 147 void PluginInstaller::DownloadCancelled() { |
| 148 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); | 148 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); |
| 149 state_ = INSTALLER_STATE_IDLE; | 149 state_ = INSTALLER_STATE_IDLE; |
| 150 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); | 150 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); |
| 151 } | 151 } |
| OLD | NEW |