| 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/plugin_installer.h" | 5 #include "chrome/browser/plugin_installer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 DownloadService* download_service = | 141 DownloadService* download_service = |
| 142 DownloadServiceFactory::GetForProfile(wrapper->profile()); | 142 DownloadServiceFactory::GetForProfile(wrapper->profile()); |
| 143 download_util::RecordDownloadSource( | 143 download_util::RecordDownloadSource( |
| 144 download_util::INITIATED_BY_PLUGIN_INSTALLER); | 144 download_util::INITIATED_BY_PLUGIN_INSTALLER); |
| 145 BrowserThread::PostTask( | 145 BrowserThread::PostTask( |
| 146 BrowserThread::IO, FROM_HERE, | 146 BrowserThread::IO, FROM_HERE, |
| 147 base::Bind(&BeginDownload, | 147 base::Bind(&BeginDownload, |
| 148 plugin_url_, ResourceDispatcherHost::Get(), | 148 plugin_url_, ResourceDispatcherHost::Get(), |
| 149 wrapper->profile()->GetResourceContext(), | 149 wrapper->profile()->GetResourceContext(), |
| 150 web_contents->GetRenderProcessHost()->GetID(), | 150 web_contents->GetRenderProcessHost()->GetID(), |
| 151 web_contents->GetRenderViewHost()->routing_id(), | 151 web_contents->GetRenderViewHost()->GetRoutingID(), |
| 152 base::Bind(&PluginInstaller::DownloadStarted, | 152 base::Bind(&PluginInstaller::DownloadStarted, |
| 153 base::Unretained(this), | 153 base::Unretained(this), |
| 154 make_scoped_refptr( | 154 make_scoped_refptr( |
| 155 download_service->GetDownloadManager())))); | 155 download_service->GetDownloadManager())))); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void PluginInstaller::DownloadStarted( | 158 void PluginInstaller::DownloadStarted( |
| 159 scoped_refptr<content::DownloadManager> dlm, | 159 scoped_refptr<content::DownloadManager> dlm, |
| 160 content::DownloadId download_id, | 160 content::DownloadId download_id, |
| 161 net::Error error) { | 161 net::Error error) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 186 DCHECK(state_ == kStateDownloading); | 186 DCHECK(state_ == kStateDownloading); |
| 187 state_ = kStateIdle; | 187 state_ = kStateIdle; |
| 188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); | 188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void PluginInstaller::DownloadCancelled() { | 191 void PluginInstaller::DownloadCancelled() { |
| 192 DCHECK(state_ == kStateDownloading); | 192 DCHECK(state_ == kStateDownloading); |
| 193 state_ = kStateIdle; | 193 state_ = kStateIdle; |
| 194 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); | 194 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); |
| 195 } | 195 } |
| OLD | NEW |