Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2646)

Unified Diff: chrome/browser/plugin_installer.h

Issue 10263022: Move version metadata from PluginGroup into PluginInstaller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugin_infobar_delegates.cc ('k') | chrome/browser/plugin_installer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugin_installer.h
diff --git a/chrome/browser/plugin_installer.h b/chrome/browser/plugin_installer.h
index b3a9f53543c6bcc602211138d4d7ad7298b0cb59..89cc7c7bde31abea1ad0ea7e2d12ca22aef04d72 100644
--- a/chrome/browser/plugin_installer.h
+++ b/chrome/browser/plugin_installer.h
@@ -8,6 +8,7 @@
#include "base/observer_list.h"
#include "base/string16.h"
+#include "base/version.h"
#include "googleurl/src/gurl.h"
#include "content/public/browser/download_id.h"
#include "content/public/browser/download_item.h"
@@ -22,19 +23,29 @@ namespace content {
class WebContents;
}
+namespace webkit {
+struct WebPluginInfo;
+}
+
class PluginInstaller : public content::DownloadItem::Observer {
public:
- enum State {
- kStateIdle,
- kStateDownloading,
+ enum InstallerState {
+ INSTALLER_STATE_IDLE,
+ 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 GURL& plugin_url,
- const GURL& help_url,
const string16& name,
bool url_for_display,
- bool requires_authorization);
+ const GURL& plugin_url,
+ const GURL& help_url);
virtual ~PluginInstaller();
virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
@@ -47,18 +58,12 @@ class PluginInstaller : public content::DownloadItem::Observer {
void AddWeakObserver(WeakPluginInstallerObserver* observer);
void RemoveWeakObserver(WeakPluginInstallerObserver* observer);
- State state() const { return state_; }
-
- // Unique identifier for the plug-in. Should be kept in sync with the
- // identifier in plugin_list.cc.
+ // Unique identifier for the plug-in.
const std::string& identifier() const { return identifier_; }
// Human-readable name of the plug-in.
const string16& name() const { return name_; }
- // Whether the plug-in requires user authorization to run.
- bool requires_authorization() const { return requires_authorization_; }
-
// 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
@@ -69,6 +74,15 @@ class PluginInstaller : public content::DownloadItem::Observer {
// URL to open when the user clicks on the "Problems installing?" link.
const GURL& help_url() const { return 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);
@@ -78,23 +92,32 @@ class PluginInstaller : public content::DownloadItem::Observer {
// returns false.
void StartInstalling(TabContentsWrapper* wrapper);
+ // 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();
- State state_;
- ObserverList<PluginInstallerObserver> observers_;
- ObserverList<WeakPluginInstallerObserver> weak_observers_;
-
std::string identifier_;
- GURL plugin_url_;
- GURL help_url_;
string16 name_;
bool url_for_display_;
- bool requires_authorization_;
+ GURL plugin_url_;
+ GURL help_url_;
+ std::map<Version, SecurityStatus, VersionComparator> versions_;
+
+ InstallerState state_;
+ ObserverList<PluginInstallerObserver> observers_;
+ ObserverList<WeakPluginInstallerObserver> weak_observers_;
DISALLOW_COPY_AND_ASSIGN(PluginInstaller);
};
« no previous file with comments | « chrome/browser/plugin_infobar_delegates.cc ('k') | chrome/browser/plugin_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698