| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 base::Bind(callback, content::DownloadId::Invalid(), error)); | 57 base::Bind(callback, content::DownloadId::Invalid(), error)); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 } | 61 } |
| 62 | 62 |
| 63 PluginInstaller::PluginInstaller(const std::string& identifier, | 63 PluginInstaller::PluginInstaller(const std::string& identifier, |
| 64 const GURL& plugin_url, | 64 const GURL& plugin_url, |
| 65 const GURL& help_url, | 65 const GURL& help_url, |
| 66 const string16& name, | 66 const string16& name, |
| 67 bool url_for_display) | 67 bool url_for_display, |
| 68 bool requires_authorization) |
| 68 : state_(kStateIdle), | 69 : state_(kStateIdle), |
| 69 identifier_(identifier), | 70 identifier_(identifier), |
| 70 plugin_url_(plugin_url), | 71 plugin_url_(plugin_url), |
| 71 help_url_(help_url), | 72 help_url_(help_url), |
| 72 name_(name), | 73 name_(name), |
| 73 url_for_display_(url_for_display) { | 74 url_for_display_(url_for_display), |
| 75 requires_authorization_(requires_authorization) { |
| 74 } | 76 } |
| 75 | 77 |
| 76 PluginInstaller::~PluginInstaller() { | 78 PluginInstaller::~PluginInstaller() { |
| 77 } | 79 } |
| 78 | 80 |
| 79 void PluginInstaller::OnDownloadUpdated(DownloadItem* download) { | 81 void PluginInstaller::OnDownloadUpdated(DownloadItem* download) { |
| 80 DownloadItem::DownloadState state = download->GetState(); | 82 DownloadItem::DownloadState state = download->GetState(); |
| 81 switch (state) { | 83 switch (state) { |
| 82 case DownloadItem::IN_PROGRESS: | 84 case DownloadItem::IN_PROGRESS: |
| 83 return; | 85 return; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 DCHECK(state_ == kStateDownloading); | 190 DCHECK(state_ == kStateDownloading); |
| 189 state_ = kStateIdle; | 191 state_ = kStateIdle; |
| 190 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); | 192 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); |
| 191 } | 193 } |
| 192 | 194 |
| 193 void PluginInstaller::DownloadCancelled() { | 195 void PluginInstaller::DownloadCancelled() { |
| 194 DCHECK(state_ == kStateDownloading); | 196 DCHECK(state_ == kStateDownloading); |
| 195 state_ = kStateIdle; | 197 state_ = kStateIdle; |
| 196 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); | 198 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); |
| 197 } | 199 } |
| OLD | NEW |