OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Returns the plugin name with the given |mime_type| and |language| or | 67 // Returns the plugin name with the given |mime_type| and |language| or |
68 // |mime_type| if not found. | 68 // |mime_type| if not found. |
69 base::string16 FindPluginName(const std::string& mime_type, | 69 base::string16 FindPluginName(const std::string& mime_type, |
70 const std::string& language); | 70 const std::string& language); |
71 | 71 |
72 // Gets plugin metadata using |plugin|. | 72 // Gets plugin metadata using |plugin|. |
73 scoped_ptr<PluginMetadata> GetPluginMetadata( | 73 scoped_ptr<PluginMetadata> GetPluginMetadata( |
74 const content::WebPluginInfo& plugin); | 74 const content::WebPluginInfo& plugin); |
75 | 75 |
76 private: | 76 private: |
77 friend struct DefaultSingletonTraits<PluginFinder>; | 77 friend struct base::DefaultSingletonTraits<PluginFinder>; |
78 friend class Singleton<PluginFinder>; | |
79 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); | 78 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); |
80 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); | 79 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); |
81 | 80 |
82 PluginFinder(); | 81 PluginFinder(); |
83 ~PluginFinder(); | 82 ~PluginFinder(); |
84 | 83 |
85 // Loads the plugin information from the browser resources and parses it. | 84 // Loads the plugin information from the browser resources and parses it. |
86 // Returns NULL if the plugin list couldn't be parsed. | 85 // Returns NULL if the plugin list couldn't be parsed. |
87 static base::DictionaryValue* LoadBuiltInPluginList(); | 86 static base::DictionaryValue* LoadBuiltInPluginList(); |
88 | 87 |
89 #if defined(ENABLE_PLUGIN_INSTALLATION) | 88 #if defined(ENABLE_PLUGIN_INSTALLATION) |
90 std::map<std::string, PluginInstaller*> installers_; | 89 std::map<std::string, PluginInstaller*> installers_; |
91 #endif | 90 #endif |
92 | 91 |
93 std::map<std::string, PluginMetadata*> identifier_plugin_; | 92 std::map<std::string, PluginMetadata*> identifier_plugin_; |
94 | 93 |
95 // Version of the metadata information. We use this to consolidate multiple | 94 // Version of the metadata information. We use this to consolidate multiple |
96 // sources (baked into resource and fetched from a URL), making sure that we | 95 // sources (baked into resource and fetched from a URL), making sure that we |
97 // don't overwrite newer versions with older ones. | 96 // don't overwrite newer versions with older ones. |
98 int version_; | 97 int version_; |
99 | 98 |
100 // Synchronization for the above member variables is | 99 // Synchronization for the above member variables is |
101 // required since multiple threads can be accessing them concurrently. | 100 // required since multiple threads can be accessing them concurrently. |
102 base::Lock mutex_; | 101 base::Lock mutex_; |
103 | 102 |
104 DISALLOW_COPY_AND_ASSIGN(PluginFinder); | 103 DISALLOW_COPY_AND_ASSIGN(PluginFinder); |
105 }; | 104 }; |
106 | 105 |
107 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ | 106 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ |
OLD | NEW |