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