| 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 19 matching lines...) Expand all Loading... |
| 30 // This class should be created and initialized by calling | 30 // This class should be created and initialized by calling |
| 31 // |GetInstance()| and |Init()| on the UI thread. | 31 // |GetInstance()| and |Init()| on the UI thread. |
| 32 // After that it can be safely used on any other thread. | 32 // After that it can be safely used on any other thread. |
| 33 class PluginFinder { | 33 class PluginFinder { |
| 34 public: | 34 public: |
| 35 static PluginFinder* GetInstance(); | 35 static PluginFinder* GetInstance(); |
| 36 | 36 |
| 37 // It should be called on the UI thread. | 37 // It should be called on the UI thread. |
| 38 void Init(); | 38 void Init(); |
| 39 | 39 |
| 40 // TODO(ibraaaa): DELETE. http://crbug.com/124396 | |
| 41 static void Get(const base::Callback<void(PluginFinder*)>& cb); | |
| 42 | |
| 43 #if defined(ENABLE_PLUGIN_INSTALLATION) | 40 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 44 // Finds a plug-in for the given MIME type and language (specified as an IETF | 41 // Finds a plug-in for the given MIME type and language (specified as an IETF |
| 45 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in, | 42 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in, |
| 46 // or NULL if no plug-in is found. | 43 // or NULL if no plug-in is found. |
| 47 PluginInstaller* FindPlugin(const std::string& mime_type, | 44 PluginInstaller* FindPlugin(const std::string& mime_type, |
| 48 const std::string& language); | 45 const std::string& language); |
| 49 | 46 |
| 50 // Returns the plug-in with the given identifier. | 47 // Returns the plug-in with the given identifier. |
| 51 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier); | 48 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier); |
| 52 #endif | 49 #endif |
| 53 | 50 |
| 54 // Returns the plug-in metadata with the given identifier. | 51 // Returns the plug-in name with the given identifier. |
| 55 PluginMetadata* FindPluginMetadataWithIdentifier( | 52 string16 FindPluginNameWithIdentifier(const std::string& identifier); |
| 56 const std::string& identifier); | |
| 57 | 53 |
| 58 // Gets plug-in metadata using |plugin|. | 54 // Gets plug-in metadata using |plugin|. |
| 59 PluginMetadata* GetPluginMetadata(const webkit::WebPluginInfo& plugin); | 55 PluginMetadata* GetPluginMetadata(const webkit::WebPluginInfo& plugin); |
| 60 | 56 |
| 61 private: | 57 private: |
| 62 friend struct DefaultSingletonTraits<PluginFinder>; | 58 friend struct DefaultSingletonTraits<PluginFinder>; |
| 63 friend class Singleton<PluginFinder>; | 59 friend class Singleton<PluginFinder>; |
| 64 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); | 60 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); |
| 65 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); | 61 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); |
| 66 | 62 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 91 | 87 |
| 92 // Synchronization for |installers_|, |identifier_plugin_| and | 88 // Synchronization for |installers_|, |identifier_plugin_| and |
| 93 // |name_plugin_| are required since multiple threads | 89 // |name_plugin_| are required since multiple threads |
| 94 // can be accessing them concurrently. | 90 // can be accessing them concurrently. |
| 95 base::Lock mutex_; | 91 base::Lock mutex_; |
| 96 | 92 |
| 97 DISALLOW_COPY_AND_ASSIGN(PluginFinder); | 93 DISALLOW_COPY_AND_ASSIGN(PluginFinder); |
| 98 }; | 94 }; |
| 99 | 95 |
| 100 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ | 96 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ |
| OLD | NEW |