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

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: Adding a method to PluginFinder to get a PluginInstaller by WebPluginInfo. Created 8 years, 4 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') | chrome/browser/plugin_finder.cc » ('J')
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"
16 #include "base/memory/weak_ptr.h"
Bernhard Bauer 2012/08/23 09:05:07 Nit: Unnecessary #include.
ibraaaa 2012/08/23 09:58:33 Done.
15 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "webkit/plugins/webplugininfo.h"
16 19
17 namespace base { 20 namespace base {
18 class DictionaryValue; 21 class DictionaryValue;
19 } 22 }
20 23
21 class GURL; 24 class GURL;
22 class PluginInstaller; 25 class PluginInstaller;
23 26
24 class PluginFinder { 27 class PluginFinder {
25 public: 28 public:
26 static void Get(const base::Callback<void(PluginFinder*)>& cb); 29 static void Get(const base::Callback<void(PluginFinder*)>& cb);
27 30
28 // Finds a plug-in for the given MIME type and language (specified as an IETF 31 // 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, 32 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in,
30 // or NULL if no plug-in is found. 33 // or NULL if no plug-in is found.
31 PluginInstaller* FindPlugin(const std::string& mime_type, 34 PluginInstaller* FindPlugin(const std::string& mime_type,
32 const std::string& language); 35 const std::string& language);
33 36
34 // Returns the plug-in with the given identifier. 37 // Returns the plug-in with the given identifier.
35 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier); 38 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier);
36 39
40 // Gets a plug-in installer using web plug-in info.
41 PluginInstaller* GetPluginInstaller(const webkit::WebPluginInfo& plugin);
42
37 private: 43 private:
38 friend struct DefaultSingletonTraits<PluginFinder>; 44 friend struct DefaultSingletonTraits<PluginFinder>;
39 friend class Singleton<PluginFinder>; 45 friend class Singleton<PluginFinder>;
40 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); 46 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax);
41 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); 47 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups);
42 48
43 static PluginFinder* GetInstance(); 49 static PluginFinder* GetInstance();
44 50
45 PluginFinder(); 51 PluginFinder();
46 ~PluginFinder(); 52 ~PluginFinder();
47 53
48 // Loads the plug-in information from the browser resources and parses it. 54 // Loads the plug-in information from the browser resources and parses it.
49 // Returns NULL if the plug-in list couldn't be parsed. 55 // Returns NULL if the plug-in list couldn't be parsed.
50 static base::DictionaryValue* LoadPluginList(); 56 static base::DictionaryValue* LoadPluginList();
51 57
52 PluginInstaller* CreateInstaller(const std::string& identifier, 58 PluginInstaller* CreateInstaller(const std::string& identifier,
53 const base::DictionaryValue* plugin_dict); 59 const base::DictionaryValue* plugin_dict);
54 60
55 scoped_ptr<base::DictionaryValue> plugin_list_; 61 scoped_ptr<base::DictionaryValue> plugin_list_;
56 std::map<std::string, PluginInstaller*> installers_; 62 std::map<std::string, PluginInstaller*> installers_;
63 // Note: Don't free memory for its values since it holds pointers
64 // to same instances in |installers_| (Double De-allocation).
65 base::hash_map<string16, PluginInstaller*> name_installers_;
57 66
58 DISALLOW_COPY_AND_ASSIGN(PluginFinder); 67 DISALLOW_COPY_AND_ASSIGN(PluginFinder);
59 }; 68 };
60 69
61 #endif // CHROME_BROWSER_PLUGIN_FINDER_H_ 70 #endif // CHROME_BROWSER_PLUGIN_FINDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugin_finder.cc » ('j') | chrome/browser/plugin_finder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698