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

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

Issue 11348046: Add versioning to PluginFinder metadata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: divx Created 7 years, 10 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
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_FINDER_H_ 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 // After that it can be safely used on any other thread. 33 // After that it can be safely used on any other thread.
34 class PluginFinder { 34 class PluginFinder {
35 public: 35 public:
36 static void RegisterPrefs(PrefRegistrySimple* registry); 36 static void RegisterPrefs(PrefRegistrySimple* registry);
37 37
38 static PluginFinder* GetInstance(); 38 static PluginFinder* GetInstance();
39 39
40 // It should be called on the UI thread. 40 // It should be called on the UI thread.
41 void Init(); 41 void Init();
42 42
43 void ReinitializePlugins(const base::DictionaryValue* json_metadata);
44
43 #if defined(ENABLE_PLUGIN_INSTALLATION) 45 #if defined(ENABLE_PLUGIN_INSTALLATION)
44 void ReinitializePlugins(const base::DictionaryValue& json_metadata);
45
46 // Finds a plug-in for the given MIME type and language (specified as an IETF 46 // Finds a plug-in for the given MIME type and language (specified as an IETF
47 // language tag, i.e. en-US). If found, sets |installer| to the 47 // language tag, i.e. en-US). If found, sets |installer| to the
48 // corresponding PluginInstaller and |plugin_metadata| to a copy of the 48 // corresponding PluginInstaller and |plugin_metadata| to a copy of the
49 // corresponding PluginMetadata. 49 // corresponding PluginMetadata.
50 bool FindPlugin(const std::string& mime_type, 50 bool FindPlugin(const std::string& mime_type,
51 const std::string& language, 51 const std::string& language,
52 PluginInstaller** installer, 52 PluginInstaller** installer,
53 scoped_ptr<PluginMetadata>* plugin_metadata); 53 scoped_ptr<PluginMetadata>* plugin_metadata);
54 54
55 // Finds the plug-in with the given identifier. If found, sets |installer| 55 // Finds the plug-in with the given identifier. If found, sets |installer|
(...skipping 13 matching lines...) Expand all
69 69
70 private: 70 private:
71 friend struct DefaultSingletonTraits<PluginFinder>; 71 friend struct DefaultSingletonTraits<PluginFinder>;
72 friend class Singleton<PluginFinder>; 72 friend class Singleton<PluginFinder>;
73 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); 73 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax);
74 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); 74 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups);
75 75
76 PluginFinder(); 76 PluginFinder();
77 ~PluginFinder(); 77 ~PluginFinder();
78 78
79 static base::DictionaryValue* ComputePluginList();
80
81 // Loads the plug-in information from the browser resources and parses it. 79 // Loads the plug-in information from the browser resources and parses it.
82 // Returns NULL if the plug-in list couldn't be parsed. 80 // Returns NULL if the plug-in list couldn't be parsed.
83 static base::DictionaryValue* LoadPluginList(); 81 static base::DictionaryValue* LoadBuiltInPluginList();
84 82
85 void InitInternal();
86
87 scoped_ptr<base::DictionaryValue> plugin_list_;
88 #if defined(ENABLE_PLUGIN_INSTALLATION) 83 #if defined(ENABLE_PLUGIN_INSTALLATION)
89 std::map<std::string, PluginInstaller*> installers_; 84 std::map<std::string, PluginInstaller*> installers_;
90 #endif 85 #endif
91 86
92 std::map<std::string, PluginMetadata*> identifier_plugin_; 87 std::map<std::string, PluginMetadata*> identifier_plugin_;
93 88
89 // Version of the metadata information. We use this to consolidate multiple
90 // sources (baked into resource and fetched from a URL), making sure that we
91 // don't overwrite newer versions with older ones.
92 int version_;
93
94 // Synchronization for the above member variables is 94 // Synchronization for the above member variables is
95 // required since multiple threads can be accessing them concurrently. 95 // required since multiple threads can be accessing them concurrently.
96 base::Lock mutex_; 96 base::Lock mutex_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(PluginFinder); 98 DISALLOW_COPY_AND_ASSIGN(PluginFinder);
99 }; 99 };
100 100
101 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ 101 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698