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

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

Issue 1991005: (1) Group plugins with the same name together. (2) Show a download link for p... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugin_service.cc ('k') | chrome/browser/plugin_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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_UPDATER_H_
6 #define CHROME_BROWSER_PLUGIN_UPDATER_H_
7
8 #include <vector>
9 #include "base/basictypes.h"
10 #include "base/linked_ptr.h"
11 #include "base/scoped_ptr.h"
12 #include "base/singleton.h"
13 #include "base/string16.h"
14 #include "base/values.h"
15 #include "googleurl/src/gurl.h"
16 #include "webkit/glue/plugins/webplugininfo.h"
17
18 class Version;
19 class Profile;
20
21 // Hard-coded definitions of plugin groups.
22 typedef struct {
23 const char* const name; // Name of this group.
24 const char* const name_matcher; // Substring matcher for the plugin name.
25 const char* const version_matcher_low; // Matchers for the plugin version.
26 const char* const version_matcher_high;
27 const char* const min_version; // Minimum secure version.
28 const char* const update_url; // Location of latest secure version.
29 } PluginGroupDefinition;
30
31
32 // A PluginGroup contains at least one WebPluginInfo.
33 // In addition, it knows if the plugin is critically vulnerable.
34 class PluginGroup {
35 public:
36 // Creates a PluginGroup from a PluginGroupDefinition.
37 static PluginGroup* FromPluginGroupDefinition(
38 const PluginGroupDefinition& definition);
39
40 // Creates a PluginGroup from a WebPluginInfo -- when no hard-coded
41 // definition is found.
42 static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi);
43
44 // Creates a copy of this plugin group.
45 PluginGroup* Copy();
46
47 // Returns true if the given plugin matches this group.
48 bool Match(const WebPluginInfo& plugin) const;
49
50 // Adds the given plugin to this group. Provide the position of the
51 // plugin as given by PluginList so we can display its priority.
52 void AddPlugin(const WebPluginInfo& plugin, int position);
53
54 // Enables/disables this group. This enables/disables all plugins in the
55 // group.
56 void Enable(bool enable);
57
58 // Returns this group's name
59 const string16 GetGroupName() const;
60
61 // Returns a DictionaryValue with data to display in the UI.
62 DictionaryValue* GetData() const;
63
64 // Returns a DictionaryValue with data to save in the preferences.
65 DictionaryValue* GetSummary() const;
66
67 // Returns true if the latest plugin in this group has known
68 // security problems.
69 bool IsVulnerable() const;
70
71 private:
72 PluginGroup(const string16& group_name,
73 const string16& name_matcher,
74 const std::string& version_range_low,
75 const std::string& version_range_high,
76 const std::string& min_version,
77 const std::string& update_url);
78
79 string16 group_name_;
80 string16 name_matcher_;
81 std::string version_range_low_str_;
82 std::string version_range_high_str_;
83 scoped_ptr<Version> version_range_low_;
84 scoped_ptr<Version> version_range_high_;
85 string16 description_;
86 std::string update_url_;
87 bool enabled_;
88 std::string min_version_str_;
89 scoped_ptr<Version> min_version_;
90 scoped_ptr<Version> max_version_;
91 std::vector<WebPluginInfo> web_plugin_infos_;
92 std::vector<int> web_plugin_positions_;
93
94 DISALLOW_COPY_AND_ASSIGN(PluginGroup);
95 };
96
97 class PluginUpdater {
98 public:
99 // Returns the PluginUpdater singleton.
100 static PluginUpdater* GetInstance();
101
102 static const PluginGroupDefinition* GetPluginGroupDefinitions();
103 static const size_t GetPluginGroupDefinitionsSize();
104
105 // Get a list of all the Plugin groups.
106 ListValue* GetPluginGroupsData();
107
108 // Get a list of all the Plugin groups.
109 ListValue* GetPluginGroupsSummary();
110
111 // Enable or disable a plugin group.
112 void EnablePluginGroup(bool enable, const string16& group_name);
113
114 // Enable or disable a specific plugin file.
115 void EnablePluginFile(bool enable, const FilePath::StringType& file_path);
116
117 // Disable all plugin groups as defined by the user's preference file.
118 void DisablePluginGroupsFromPrefs(Profile* profile);
119
120 // Write the enable/disable status to the user's preference file.
121 void UpdatePreferences(Profile* profile);
122
123 private:
124 friend struct DefaultSingletonTraits<PluginUpdater>;
125
126 PluginUpdater();
127 ~PluginUpdater();
128
129 void GetPluginGroups(std::vector<linked_ptr<PluginGroup> >* plugin_groups);
130
131 DictionaryValue* CreatePluginFileSummary(const WebPluginInfo& plugin);
132
133 std::vector<linked_ptr<PluginGroup> > plugin_group_definitions_;
134
135 DISALLOW_COPY_AND_ASSIGN(PluginUpdater);
136 };
137
138 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugin_service.cc ('k') | chrome/browser/plugin_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698