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

Side by Side Diff: chrome/browser/plugin_installer.h

Issue 10823434: [6] Moves CreateVersionFromString to plugin_utils and updates the callers. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_PLUGIN_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_INSTALLER_H_
6 #define CHROME_BROWSER_PLUGIN_INSTALLER_H_ 6 #define CHROME_BROWSER_PLUGIN_INSTALLER_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/version.h" 10 #include "base/version.h"
(...skipping 26 matching lines...) Expand all
37 enum SecurityStatus { 37 enum SecurityStatus {
38 SECURITY_STATUS_UP_TO_DATE, 38 SECURITY_STATUS_UP_TO_DATE,
39 SECURITY_STATUS_OUT_OF_DATE, 39 SECURITY_STATUS_OUT_OF_DATE,
40 SECURITY_STATUS_REQUIRES_AUTHORIZATION, 40 SECURITY_STATUS_REQUIRES_AUTHORIZATION,
41 }; 41 };
42 42
43 PluginInstaller(const std::string& identifier, 43 PluginInstaller(const std::string& identifier,
44 const string16& name, 44 const string16& name,
45 bool url_for_display, 45 bool url_for_display,
46 const GURL& plugin_url, 46 const GURL& plugin_url,
47 const GURL& help_url); 47 const GURL& help_url,
48 const string16& group_name_matcher);
48 virtual ~PluginInstaller(); 49 virtual ~PluginInstaller();
49 50
50 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; 51 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
51 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; 52 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
52 53
53 void AddObserver(PluginInstallerObserver* observer); 54 void AddObserver(PluginInstallerObserver* observer);
54 void RemoveObserver(PluginInstallerObserver* observer); 55 void RemoveObserver(PluginInstallerObserver* observer);
55 56
56 void AddWeakObserver(WeakPluginInstallerObserver* observer); 57 void AddWeakObserver(WeakPluginInstallerObserver* observer);
57 void RemoveWeakObserver(WeakPluginInstallerObserver* observer); 58 void RemoveWeakObserver(WeakPluginInstallerObserver* observer);
58 59
59 // Unique identifier for the plug-in. 60 // Unique identifier for the plug-in.
60 const std::string& identifier() const { return identifier_; } 61 const std::string& identifier() const { return identifier_; }
61 62
62 // Human-readable name of the plug-in. 63 // Human-readable name of the plug-in.
63 const string16& name() const { return name_; } 64 const string16& name() const { return name_; }
64 65
66 // A substring used in matching similar plug-ins.
67 const string16& group_name_matcher() const { return group_name_matcher_; }
68
65 // If |url_for_display| is false, |plugin_url| is the URL of the download page 69 // If |url_for_display| is false, |plugin_url| is the URL of the download page
66 // for the plug-in, which should be opened in a new tab. If it is true, 70 // for the plug-in, which should be opened in a new tab. If it is true,
67 // |plugin_url| is the URL of the plug-in installer binary, which can be 71 // |plugin_url| is the URL of the plug-in installer binary, which can be
68 // directly downloaded. 72 // directly downloaded.
69 bool url_for_display() const { return url_for_display_; } 73 bool url_for_display() const { return url_for_display_; }
70 const GURL& plugin_url() const { return plugin_url_; } 74 const GURL& plugin_url() const { return plugin_url_; }
71 75
72 // URL to open when the user clicks on the "Problems installing?" link. 76 // URL to open when the user clicks on the "Problems installing?" link.
73 const GURL& help_url() const { return help_url_; } 77 const GURL& help_url() const { return help_url_; }
74 78
(...skipping 13 matching lines...) Expand all
88 // Starts downloading the download URL and opens the downloaded file 92 // Starts downloading the download URL and opens the downloaded file
89 // when finished. This method should only be called if |url_for_display| 93 // when finished. This method should only be called if |url_for_display|
90 // returns false. 94 // returns false.
91 void StartInstalling(TabContents* tab_contents); 95 void StartInstalling(TabContents* tab_contents);
92 96
93 // If |status_str| describes a valid security status, writes it to |status| 97 // If |status_str| describes a valid security status, writes it to |status|
94 // and returns true, else returns false and leaves |status| unchanged. 98 // and returns true, else returns false and leaves |status| unchanged.
95 static bool ParseSecurityStatus(const std::string& status_str, 99 static bool ParseSecurityStatus(const std::string& status_str,
96 SecurityStatus* status); 100 SecurityStatus* status);
97 101
102 // Returns matcher part of configured plug-in group names,
103 // or the filename without extension if the name is empty.
104 static string16 GetGroupName(const webkit::WebPluginInfo& plugin);
105
106 // Generates the (short) identifier string for the given plug-in.
107 // It searches in configured plug-in groups first, and returns the identifier
108 // if a match was found, otherwise it uses the base name of the file path.
109 static std::string GetIdentifier(const webkit::WebPluginInfo& plugin);
98 private: 110 private:
99 struct VersionComparator { 111 struct VersionComparator {
100 bool operator() (const Version& lhs, const Version& rhs) const; 112 bool operator() (const Version& lhs, const Version& rhs) const;
101 }; 113 };
102 114
103 void DownloadStarted(scoped_refptr<content::DownloadManager> dlm, 115 void DownloadStarted(scoped_refptr<content::DownloadManager> dlm,
104 content::DownloadId download_id, 116 content::DownloadId download_id,
105 net::Error error); 117 net::Error error);
106 void DownloadError(const std::string& msg); 118 void DownloadError(const std::string& msg);
107 void DownloadCancelled(); 119 void DownloadCancelled();
120 static PluginInstaller* MatchWithConfiguredPlugins(
121 const webkit::WebPluginInfo& plugin);
108 122
109 std::string identifier_; 123 std::string identifier_;
110 string16 name_; 124 string16 name_;
125 string16 group_name_matcher_;
111 bool url_for_display_; 126 bool url_for_display_;
112 GURL plugin_url_; 127 GURL plugin_url_;
113 GURL help_url_; 128 GURL help_url_;
114 std::map<Version, SecurityStatus, VersionComparator> versions_; 129 std::map<Version, SecurityStatus, VersionComparator> versions_;
115 130
116 InstallerState state_; 131 InstallerState state_;
117 ObserverList<PluginInstallerObserver> observers_; 132 ObserverList<PluginInstallerObserver> observers_;
118 ObserverList<WeakPluginInstallerObserver> weak_observers_; 133 ObserverList<WeakPluginInstallerObserver> weak_observers_;
119 134
120 DISALLOW_COPY_AND_ASSIGN(PluginInstaller); 135 DISALLOW_COPY_AND_ASSIGN(PluginInstaller);
121 }; 136 };
122 137
123 #endif // CHROME_BROWSER_PLUGIN_INSTALLER_H_ 138 #endif // CHROME_BROWSER_PLUGIN_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698