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

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

Issue 10066016: Fix plug-in identifier for Shockwave and add a unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/gtest_prod_util.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"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 } 20 }
20 21
21 class GURL; 22 class GURL;
22 class PluginInstaller; 23 class PluginInstaller;
23 24
24 class PluginFinder { 25 class PluginFinder {
25 public: 26 public:
26 static void Get(const base::Callback<void(PluginFinder*)>& cb); 27 static void Get(const base::Callback<void(PluginFinder*)>& cb);
27 28
28 // Loads the plug-in information from the browser resources and parses it.
29 // Returns NULL if the plug-in list couldn't be parsed.
30 static scoped_ptr<base::DictionaryValue> LoadPluginList();
31
32 // Finds a plug-in for the given MIME type and language (specified as an IETF 29 // Finds a plug-in for the given MIME type and language (specified as an IETF
33 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in, 30 // language tag, i.e. en-US) and returns the PluginInstaller for the plug-in,
34 // or NULL if no plug-in is found. 31 // or NULL if no plug-in is found.
35 PluginInstaller* FindPlugin(const std::string& mime_type, 32 PluginInstaller* FindPlugin(const std::string& mime_type,
36 const std::string& language); 33 const std::string& language);
37 34
38 // Returns the plug-in with the given identifier. 35 // Returns the plug-in with the given identifier.
39 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier); 36 PluginInstaller* FindPluginWithIdentifier(const std::string& identifier);
40 37
41 private: 38 private:
42 friend struct DefaultSingletonTraits<PluginFinder>; 39 friend struct DefaultSingletonTraits<PluginFinder>;
43 friend class Singleton<PluginFinder>; 40 friend class Singleton<PluginFinder>;
41 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax);
42 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups);
44 43
45 static PluginFinder* GetInstance(); 44 static PluginFinder* GetInstance();
46 45
47 PluginFinder(); 46 PluginFinder();
48 ~PluginFinder(); 47 ~PluginFinder();
49 48
50 static base::DictionaryValue* LoadPluginListInternal(); 49 // Loads the plug-in information from the browser resources and parses it.
50 // Returns NULL if the plug-in list couldn't be parsed.
51 static base::DictionaryValue* LoadPluginList();
51 52
52 PluginInstaller* CreateInstaller(const std::string& identifier, 53 PluginInstaller* CreateInstaller(const std::string& identifier,
53 const base::DictionaryValue* plugin_dict); 54 const base::DictionaryValue* plugin_dict);
54 55
55 scoped_ptr<base::DictionaryValue> plugin_list_; 56 scoped_ptr<base::DictionaryValue> plugin_list_;
56 std::map<std::string, PluginInstaller*> installers_; 57 std::map<std::string, PluginInstaller*> installers_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(PluginFinder); 59 DISALLOW_COPY_AND_ASSIGN(PluginFinder);
59 }; 60 };
60 61
61 #endif // CHROME_BROWSER_PLUGIN_FINDER_H_ 62 #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