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

Side by Side Diff: chrome/browser/plugins/plugin_metadata.h

Issue 11016005: Using MIME types in addition to plugin name to differentiate between plugins. (Closed) Base URL: http://git.chromium.org/chromium/src.git@5_plugins_resource_service
Patch Set: .. Created 8 years, 2 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_PLUGINS_PLUGIN_METADATA_H_ 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 22 matching lines...) Expand all
33 static const char kShockwaveGroupName[]; 33 static const char kShockwaveGroupName[];
34 static const char kRealPlayerGroupName[]; 34 static const char kRealPlayerGroupName[];
35 static const char kSilverlightGroupName[]; 35 static const char kSilverlightGroupName[];
36 static const char kWindowsMediaPlayerGroupName[]; 36 static const char kWindowsMediaPlayerGroupName[];
37 37
38 PluginMetadata(const std::string& identifier, 38 PluginMetadata(const std::string& identifier,
39 const string16& name, 39 const string16& name,
40 bool url_for_display, 40 bool url_for_display,
41 const GURL& plugin_url, 41 const GURL& plugin_url,
42 const GURL& help_url, 42 const GURL& help_url,
43 const string16& group_name_matcher); 43 const string16& group_name_matcher,
44 const std::string& language);
44 ~PluginMetadata(); 45 ~PluginMetadata();
45 46
46 // Unique identifier for the plug-in. 47 // Unique identifier for the plug-in.
47 const std::string& identifier() const { return identifier_; } 48 const std::string& identifier() const { return identifier_; }
48 49
49 // Human-readable name of the plug-in. 50 // Human-readable name of the plug-in.
50 const string16& name() const { return name_; } 51 const string16& name() const { return name_; }
51 52
52 // If |url_for_display| is false, |plugin_url| is the URL of the download page 53 // If |url_for_display| is false, |plugin_url| is the URL of the download page
53 // for the plug-in, which should be opened in a new tab. If it is true, 54 // for the plug-in, which should be opened in a new tab. If it is true,
54 // |plugin_url| is the URL of the plug-in installer binary, which can be 55 // |plugin_url| is the URL of the plug-in installer binary, which can be
55 // directly downloaded. 56 // directly downloaded.
56 bool url_for_display() const { return url_for_display_; } 57 bool url_for_display() const { return url_for_display_; }
57 const GURL& plugin_url() const { return plugin_url_; } 58 const GURL& plugin_url() const { return plugin_url_; }
58 59
59 // URL to open when the user clicks on the "Problems installing?" link. 60 // URL to open when the user clicks on the "Problems installing?" link.
60 const GURL& help_url() const { return help_url_; } 61 const GURL& help_url() const { return help_url_; }
Bernhard Bauer 2012/10/02 14:40:13 Nit: newline
ibraaaa 2012/10/02 16:14:53 Done.
62 const std::string& language() const { return language_; }
63
64 bool HasMimeType(const std::string& mime_type) const;
65 void AddMimeType(const std::string& mime_type);
66 void AddMatchingMimeType(const std::string& mime_type);
61 67
62 // Adds information about a plug-in version. 68 // Adds information about a plug-in version.
63 void AddVersion(const Version& version, SecurityStatus status); 69 void AddVersion(const Version& version, SecurityStatus status);
64 70
65 // Checks if the plug-in matches the group matcher. 71 // Checks if the plug-in matches the group matcher.
66 bool MatchesPlugin(const webkit::WebPluginInfo& plugin); 72 bool MatchesPlugin(const webkit::WebPluginInfo& plugin,
73 string16* matching_name);
67 74
68 // If |status_str| describes a valid security status, writes it to |status| 75 // If |status_str| describes a valid security status, writes it to |status|
69 // and returns true, else returns false and leaves |status| unchanged. 76 // and returns true, else returns false and leaves |status| unchanged.
70 static bool ParseSecurityStatus(const std::string& status_str, 77 static bool ParseSecurityStatus(const std::string& status_str,
71 SecurityStatus* status); 78 SecurityStatus* status);
72 79
73 // Returns the security status for the given plug-in (i.e. whether it is 80 // Returns the security status for the given plug-in (i.e. whether it is
74 // considered out-of-date, etc.) 81 // considered out-of-date, etc.)
75 SecurityStatus GetSecurityStatus(const webkit::WebPluginInfo& plugin) const; 82 SecurityStatus GetSecurityStatus(const webkit::WebPluginInfo& plugin) const;
76 83
77 scoped_ptr<PluginMetadata> Clone() const; 84 scoped_ptr<PluginMetadata> Clone() const;
78 85
79 private: 86 private:
80 struct VersionComparator { 87 struct VersionComparator {
81 bool operator() (const Version& lhs, const Version& rhs) const; 88 bool operator() (const Version& lhs, const Version& rhs) const;
82 }; 89 };
83 90
84 std::string identifier_; 91 std::string identifier_;
85 string16 name_; 92 string16 name_;
86 string16 group_name_matcher_; 93 string16 group_name_matcher_;
87 bool url_for_display_; 94 bool url_for_display_;
88 GURL plugin_url_; 95 GURL plugin_url_;
89 GURL help_url_; 96 GURL help_url_;
97 std::string language_;
90 std::map<Version, SecurityStatus, VersionComparator> versions_; 98 std::map<Version, SecurityStatus, VersionComparator> versions_;
99 std::vector<std::string> all_mime_types_;
100 std::vector<std::string> matching_mime_types_;
91 101
92 DISALLOW_COPY_AND_ASSIGN(PluginMetadata); 102 DISALLOW_COPY_AND_ASSIGN(PluginMetadata);
93 }; 103 };
94 104
95 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ 105 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698