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

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

Issue 10933044: Move chrome/browser/plugin_* to chrome/browser/plugins/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@remove_plugin_group
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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PLUGIN_INSTALLER_H_
6 #define CHROME_BROWSER_PLUGIN_INSTALLER_H_
7
8 #include "base/observer_list.h"
9 #include "base/string16.h"
10 #include "base/version.h"
11 #include "googleurl/src/gurl.h"
12 #include "content/public/browser/download_id.h"
13 #include "content/public/browser/download_item.h"
14 #include "net/base/net_errors.h"
15
16 class FilePath;
17 class PluginInstallerObserver;
18 class TabContents;
19 class WeakPluginInstallerObserver;
20
21 namespace content {
22 class WebContents;
23 }
24
25 namespace webkit {
26 struct WebPluginInfo;
27 }
28
29 class PluginInstaller : public content::DownloadItem::Observer {
30 public:
31 enum InstallerState {
32 INSTALLER_STATE_IDLE,
33 INSTALLER_STATE_DOWNLOADING,
34 };
35
36 // Information about a certain version of the plug-in.
37 enum SecurityStatus {
38 SECURITY_STATUS_UP_TO_DATE,
39 SECURITY_STATUS_OUT_OF_DATE,
40 SECURITY_STATUS_REQUIRES_AUTHORIZATION,
41 };
42
43 PluginInstaller(const std::string& identifier,
44 const string16& name,
45 bool url_for_display,
46 const GURL& plugin_url,
47 const GURL& help_url,
48 const string16& group_name_matcher);
49 virtual ~PluginInstaller();
50
51 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
52 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
53
54 void AddObserver(PluginInstallerObserver* observer);
55 void RemoveObserver(PluginInstallerObserver* observer);
56
57 void AddWeakObserver(WeakPluginInstallerObserver* observer);
58 void RemoveWeakObserver(WeakPluginInstallerObserver* observer);
59
60 // Unique identifier for the plug-in.
61 const std::string& identifier() const { return identifier_; }
62
63 // Human-readable name of the plug-in.
64 const string16& name() const { return name_; }
65
66 // Checks if the plug-in matches the group matcher.
67 bool MatchesPlugin(const webkit::WebPluginInfo& plugin);
68
69 // If |url_for_display| is false, |plugin_url| is the URL of the download page
70 // for the plug-in, which should be opened in a new tab. If it is true,
71 // |plugin_url| is the URL of the plug-in installer binary, which can be
72 // directly downloaded.
73 bool url_for_display() const { return url_for_display_; }
74 const GURL& plugin_url() const { return plugin_url_; }
75
76 // URL to open when the user clicks on the "Problems installing?" link.
77 const GURL& help_url() const { return help_url_; }
78
79 InstallerState state() const { return state_; }
80
81 // Adds information about a plug-in version.
82 void AddVersion(const Version& version, SecurityStatus status);
83
84 // Returns the security status for the given plug-in (i.e. whether it is
85 // considered out-of-date, etc.)
86 SecurityStatus GetSecurityStatus(const webkit::WebPluginInfo& plugin) const;
87
88 // Opens the download URL in a new tab. This method should only be called if
89 // |url_for_display| returns true.
90 void OpenDownloadURL(content::WebContents* web_contents);
91
92 // Starts downloading the download URL and opens the downloaded file
93 // when finished. This method should only be called if |url_for_display|
94 // returns false.
95 void StartInstalling(TabContents* tab_contents);
96
97 // If |status_str| describes a valid security status, writes it to |status|
98 // and returns true, else returns false and leaves |status| unchanged.
99 static bool ParseSecurityStatus(const std::string& status_str,
100 SecurityStatus* status);
101
102 private:
103 struct VersionComparator {
104 bool operator() (const Version& lhs, const Version& rhs) const;
105 };
106
107 void DownloadStarted(scoped_refptr<content::DownloadManager> dlm,
108 content::DownloadId download_id,
109 net::Error error);
110 void DownloadError(const std::string& msg);
111 void DownloadCancelled();
112
113 std::string identifier_;
114 string16 name_;
115 string16 group_name_matcher_;
116 bool url_for_display_;
117 GURL plugin_url_;
118 GURL help_url_;
119 std::map<Version, SecurityStatus, VersionComparator> versions_;
120
121 InstallerState state_;
122 ObserverList<PluginInstallerObserver> observers_;
123 ObserverList<WeakPluginInstallerObserver> weak_observers_;
124
125 DISALLOW_COPY_AND_ASSIGN(PluginInstaller);
126 };
127
128 #endif // CHROME_BROWSER_PLUGIN_INSTALLER_H_
OLDNEW
« 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