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

Unified Diff: chrome/browser/plugins/plugin_metadata.h

Issue 10910168: Separate plugin_metadata from plugin_installer, thread-safe plugin_finder (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: .. Created 8 years, 3 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/plugins/plugin_installer.cc ('k') | chrome/browser/plugins/plugin_metadata.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_metadata.h
diff --git a/chrome/browser/plugins/plugin_installer.h b/chrome/browser/plugins/plugin_metadata.h
similarity index 50%
copy from chrome/browser/plugins/plugin_installer.h
copy to chrome/browser/plugins/plugin_metadata.h
index 1dae7f13ecf0dd42d97aeb115ce50d902257601c..a021e7ed4fbc4bc4d1bbbfc7521584e5a59f82a0 100644
--- a/chrome/browser/plugins/plugin_installer.h
+++ b/chrome/browser/plugins/plugin_metadata.h
@@ -2,37 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_
-#define CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_
+#ifndef CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
+#define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
+
+#include <map>
-#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"
-#include "net/base/net_errors.h"
-
-class FilePath;
-class PluginInstallerObserver;
-class TabContents;
-class WeakPluginInstallerObserver;
-
-namespace content {
-class WebContents;
-}
namespace webkit {
struct WebPluginInfo;
}
-class PluginInstaller : public content::DownloadItem::Observer {
+class PluginMetadata {
public:
- enum InstallerState {
- INSTALLER_STATE_IDLE,
- INSTALLER_STATE_DOWNLOADING,
- };
-
// Information about a certain version of the plug-in.
enum SecurityStatus {
SECURITY_STATUS_UP_TO_DATE,
@@ -40,22 +24,13 @@ class PluginInstaller : public content::DownloadItem::Observer {
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);
- virtual ~PluginInstaller();
-
- virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
- virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
-
- void AddObserver(PluginInstallerObserver* observer);
- void RemoveObserver(PluginInstallerObserver* observer);
-
- void AddWeakObserver(WeakPluginInstallerObserver* observer);
- void RemoveWeakObserver(WeakPluginInstallerObserver* observer);
+ PluginMetadata(const std::string& identifier,
+ const string16& name,
+ bool url_for_display,
+ const GURL& plugin_url,
+ const GURL& help_url,
+ const string16& group_name_matcher);
+ ~PluginMetadata();
// Unique identifier for the plug-in.
const std::string& identifier() const { return identifier_; }
@@ -63,9 +38,6 @@ class PluginInstaller : public content::DownloadItem::Observer {
// 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);
-
// 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
@@ -76,40 +48,26 @@ 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);
-
- // Starts downloading the download URL and opens the downloaded file
- // when finished. This method should only be called if |url_for_display|
- // returns false.
- void StartInstalling(TabContents* tab_contents);
+ // Checks if the plug-in matches the group matcher.
+ bool MatchesPlugin(const webkit::WebPluginInfo& plugin);
// 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);
+ // 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;
+
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_;
@@ -117,12 +75,6 @@ class PluginInstaller : public content::DownloadItem::Observer {
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);
};
-#endif // CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_
+#endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
« no previous file with comments | « chrome/browser/plugins/plugin_installer.cc ('k') | chrome/browser/plugins/plugin_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698