Chromium Code Reviews| Index: chrome/browser/plugin_installer.h |
| diff --git a/chrome/browser/plugin_installer.h b/chrome/browser/plugin_installer.h |
| index 85a7f6f6b0c958d8fe43d26eae349d725fba0557..61f223fc09ebb75155347538a81c52f4ae884b17 100644 |
| --- a/chrome/browser/plugin_installer.h |
| +++ b/chrome/browser/plugin_installer.h |
| @@ -8,9 +8,10 @@ |
| #include "base/observer_list.h" |
| #include "base/string16.h" |
| #include "base/version.h" |
| -#include "googleurl/src/gurl.h" |
| +#include "chrome/browser/plugin_metadata.h" |
| #include "content/public/browser/download_id.h" |
| #include "content/public/browser/download_item.h" |
| +#include "googleurl/src/gurl.h" |
| #include "net/base/net_errors.h" |
| class FilePath; |
| @@ -33,19 +34,7 @@ class PluginInstaller : public content::DownloadItem::Observer { |
| INSTALLER_STATE_DOWNLOADING, |
| }; |
| - // Information about a certain version of the plug-in. |
| - enum SecurityStatus { |
| - SECURITY_STATUS_UP_TO_DATE, |
| - SECURITY_STATUS_OUT_OF_DATE, |
| - SECURITY_STATUS_REQUIRES_AUTHORIZATION, |
| - }; |
| - |
| - PluginInstaller(const std::string& identifier, |
| - const string16& name, |
| - bool url_for_display, |
| - const GURL& plugin_url, |
| - const GURL& help_url, |
| - const string16& group_name_matcher); |
| + explicit PluginInstaller(PluginMetadata* plugin); |
| virtual ~PluginInstaller(); |
| virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
| @@ -58,33 +47,23 @@ class PluginInstaller : public content::DownloadItem::Observer { |
| void RemoveWeakObserver(WeakPluginInstallerObserver* observer); |
| // Unique identifier for the plug-in. |
| - const std::string& identifier() const { return identifier_; } |
| + const std::string& identifier() const { return plugin_->identifier(); } |
|
ibraaaa
2012/09/11 09:43:34
I implemented these getters so that the CL doesn't
ibraaaa
2012/09/11 12:44:10
Or shall we keep them, what do you think? If we ar
|
| // Human-readable name of the plug-in. |
| - const string16& name() const { return name_; } |
| - |
| - // Checks if the plug-in matches the group matcher. |
| - bool MatchesPlugin(const webkit::WebPluginInfo& plugin); |
| + const string16& name() const { return plugin_->name(); } |
| // If |url_for_display| is false, |plugin_url| is the URL of the download page |
| // for the plug-in, which should be opened in a new tab. If it is true, |
| // |plugin_url| is the URL of the plug-in installer binary, which can be |
| // directly downloaded. |
| - bool url_for_display() const { return url_for_display_; } |
| - const GURL& plugin_url() const { return plugin_url_; } |
| + bool url_for_display() const { return plugin_->url_for_display(); } |
| + const GURL& plugin_url() const { return plugin_->plugin_url(); } |
| // URL to open when the user clicks on the "Problems installing?" link. |
| - const GURL& help_url() const { return help_url_; } |
| + const GURL& help_url() const { return plugin_->help_url(); } |
| InstallerState state() const { return state_; } |
| - // Adds information about a plug-in version. |
| - void AddVersion(const Version& version, SecurityStatus status); |
| - |
| - // Returns the security status for the given plug-in (i.e. whether it is |
| - // considered out-of-date, etc.) |
| - SecurityStatus GetSecurityStatus(const webkit::WebPluginInfo& plugin) const; |
| - |
| // Opens the download URL in a new tab. This method should only be called if |
| // |url_for_display| returns true. |
| void OpenDownloadURL(content::WebContents* web_contents); |
| @@ -94,29 +73,15 @@ class PluginInstaller : public content::DownloadItem::Observer { |
| // returns false. |
| void StartInstalling(TabContents* tab_contents); |
| - // If |status_str| describes a valid security status, writes it to |status| |
| - // and returns true, else returns false and leaves |status| unchanged. |
| - static bool ParseSecurityStatus(const std::string& status_str, |
| - SecurityStatus* status); |
| - |
| private: |
| - struct VersionComparator { |
| - bool operator() (const Version& lhs, const Version& rhs) const; |
| - }; |
| - |
| void DownloadStarted(scoped_refptr<content::DownloadManager> dlm, |
| content::DownloadId download_id, |
| net::Error error); |
| void DownloadError(const std::string& msg); |
| void DownloadCancelled(); |
| - std::string identifier_; |
| - string16 name_; |
| - string16 group_name_matcher_; |
| - bool url_for_display_; |
| - GURL plugin_url_; |
| - GURL help_url_; |
| - std::map<Version, SecurityStatus, VersionComparator> versions_; |
| + // It can't be NULL. It is owned by PluginFinder. |
| + PluginMetadata* plugin_; |
| InstallerState state_; |
| ObserverList<PluginInstallerObserver> observers_; |