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

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

Issue 10881002: [2] Adding a method to PluginFinder to get a PluginInstaller by WebPluginInfo. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing Windows Compilation Error Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/plugin_finder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PLUGIN_FINDER_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_FINDER_H_
6 #define CHROME_BROWSER_PLUGIN_FINDER_H_ 6 #define CHROME_BROWSER_PLUGIN_FINDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/hash_tables.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
15 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "webkit/plugins/webplugininfo.h"
16 18
17 namespace base { 19 namespace base {
18 class DictionaryValue; 20 class DictionaryValue;
19 } 21 }
20 22
21 class GURL; 23 class GURL;
22 class PluginInstaller; 24 class PluginInstaller;
23 25
24 class PluginFinder { 26 class PluginFinder {
25 public: 27 public:
26 static void Get(const base::Callback<void(PluginFinder*)>& cb); 28 static void Get(const base::Callback<void(PluginFinder*)>& cb);
27 29
28 // Finds a plug-in for the given MIME type and language (specified as an IETF 30 // Finds a plug-in for the given MIME type and language (specified as an IETF
29 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in, 31 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in,
30 // or NULL if no plug-in is found. 32 // or NULL if no plug-in is found.
31 PluginInstaller* FindPlugin(const std::string& mime_type, 33 PluginInstaller* FindPlugin(const std::string& mime_type,
32 const std::string& language); 34 const std::string& language);
33 35
34 // Returns the plug-in with the given identifier. 36 // Returns the plug-in with the given identifier.
35 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier); 37 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier);
36 38
39 // Gets a plug-in installer using |plugin|.
40 PluginInstaller* GetPluginInstaller(const webkit::WebPluginInfo& plugin);
41
37 private: 42 private:
38 friend struct DefaultSingletonTraits<PluginFinder>; 43 friend struct DefaultSingletonTraits<PluginFinder>;
39 friend class Singleton<PluginFinder>; 44 friend class Singleton<PluginFinder>;
40 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); 45 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax);
41 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); 46 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups);
42 47
43 static PluginFinder* GetInstance(); 48 static PluginFinder* GetInstance();
44 49
45 PluginFinder(); 50 PluginFinder();
46 ~PluginFinder(); 51 ~PluginFinder();
47 52
48 // Loads the plug-in information from the browser resources and parses it. 53 // Loads the plug-in information from the browser resources and parses it.
49 // Returns NULL if the plug-in list couldn't be parsed. 54 // Returns NULL if the plug-in list couldn't be parsed.
50 static base::DictionaryValue* LoadPluginList(); 55 static base::DictionaryValue* LoadPluginList();
51 56
52 PluginInstaller* CreateInstaller(const std::string& identifier, 57 PluginInstaller* CreateInstaller(const std::string& identifier,
53 const base::DictionaryValue* plugin_dict); 58 const base::DictionaryValue* plugin_dict);
54 59
55 scoped_ptr<base::DictionaryValue> plugin_list_; 60 scoped_ptr<base::DictionaryValue> plugin_list_;
56 std::map<std::string, PluginInstaller*> installers_; 61 std::map<std::string, PluginInstaller*> installers_;
57 62
63 // Note: Don't free memory for |name_insallers_| values
64 // since it holds pointers to same instances
65 // in |installers_| (Double De-allocation).
66 base::hash_map<string16, PluginInstaller*> name_installers_;
67
58 DISALLOW_COPY_AND_ASSIGN(PluginFinder); 68 DISALLOW_COPY_AND_ASSIGN(PluginFinder);
59 }; 69 };
60 70
61 #endif // CHROME_BROWSER_PLUGIN_FINDER_H_ 71 #endif // CHROME_BROWSER_PLUGIN_FINDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugin_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698