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

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

Issue 2405013002: Move some global feature defines to buildflags (Closed)
Patch Set: Comment Created 4 years, 2 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
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_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 <memory> 9 #include <memory>
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/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "chrome/common/features.h"
18 #include "content/public/common/webplugininfo.h" 19 #include "content/public/common/webplugininfo.h"
19 20
20 namespace base { 21 namespace base {
21 class DictionaryValue; 22 class DictionaryValue;
22 } 23 }
23 24
24 class GURL; 25 class GURL;
25 class PluginMetadata; 26 class PluginMetadata;
26 class PrefRegistrySimple; 27 class PrefRegistrySimple;
27 28
28 #if defined(ENABLE_PLUGIN_INSTALLATION) 29 #if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION)
29 class PluginInstaller; 30 class PluginInstaller;
30 #endif 31 #endif
31 32
32 // This class should be created and initialized by calling 33 // This class should be created and initialized by calling
33 // |GetInstance()| and |Init()| on the UI thread. 34 // |GetInstance()| and |Init()| on the UI thread.
34 // After that it can be safely used on any other thread. 35 // After that it can be safely used on any other thread.
35 class PluginFinder { 36 class PluginFinder {
36 public: 37 public:
37 static void RegisterPrefs(PrefRegistrySimple* registry); 38 static void RegisterPrefs(PrefRegistrySimple* registry);
38 39
39 static PluginFinder* GetInstance(); 40 static PluginFinder* GetInstance();
40 41
41 // It should be called on the UI thread. 42 // It should be called on the UI thread.
42 void Init(); 43 void Init();
43 44
44 void ReinitializePlugins(const base::DictionaryValue* json_metadata); 45 void ReinitializePlugins(const base::DictionaryValue* json_metadata);
45 46
46 #if defined(ENABLE_PLUGIN_INSTALLATION) 47 #if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION)
47 // Finds a plugin for the given MIME type and language (specified as an IETF 48 // Finds a plugin for the given MIME type and language (specified as an IETF
48 // language tag, i.e. en-US). If found, sets |installer| to the 49 // language tag, i.e. en-US). If found, sets |installer| to the
49 // corresponding PluginInstaller and |plugin_metadata| to a copy of the 50 // corresponding PluginInstaller and |plugin_metadata| to a copy of the
50 // corresponding PluginMetadata. 51 // corresponding PluginMetadata.
51 bool FindPlugin(const std::string& mime_type, 52 bool FindPlugin(const std::string& mime_type,
52 const std::string& language, 53 const std::string& language,
53 PluginInstaller** installer, 54 PluginInstaller** installer,
54 std::unique_ptr<PluginMetadata>* plugin_metadata); 55 std::unique_ptr<PluginMetadata>* plugin_metadata);
55 56
56 // Finds the plugin with the given identifier. If found, sets |installer| 57 // Finds the plugin with the given identifier. If found, sets |installer|
(...skipping 14 matching lines...) Expand all
71 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax); 72 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, JsonSyntax);
72 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups); 73 FRIEND_TEST_ALL_PREFIXES(PluginFinderTest, PluginGroups);
73 74
74 PluginFinder(); 75 PluginFinder();
75 ~PluginFinder(); 76 ~PluginFinder();
76 77
77 // Loads the plugin information from the browser resources and parses it. 78 // Loads the plugin information from the browser resources and parses it.
78 // Returns NULL if the plugin list couldn't be parsed. 79 // Returns NULL if the plugin list couldn't be parsed.
79 static base::DictionaryValue* LoadBuiltInPluginList(); 80 static base::DictionaryValue* LoadBuiltInPluginList();
80 81
81 #if defined(ENABLE_PLUGIN_INSTALLATION) 82 #if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION)
82 std::map<std::string, PluginInstaller*> installers_; 83 std::map<std::string, PluginInstaller*> installers_;
83 #endif 84 #endif
84 85
85 std::map<std::string, PluginMetadata*> identifier_plugin_; 86 std::map<std::string, PluginMetadata*> identifier_plugin_;
86 87
87 // Version of the metadata information. We use this to consolidate multiple 88 // Version of the metadata information. We use this to consolidate multiple
88 // sources (baked into resource and fetched from a URL), making sure that we 89 // sources (baked into resource and fetched from a URL), making sure that we
89 // don't overwrite newer versions with older ones. 90 // don't overwrite newer versions with older ones.
90 int version_; 91 int version_;
91 92
92 // Synchronization for the above member variables is 93 // Synchronization for the above member variables is
93 // required since multiple threads can be accessing them concurrently. 94 // required since multiple threads can be accessing them concurrently.
94 base::Lock mutex_; 95 base::Lock mutex_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(PluginFinder); 97 DISALLOW_COPY_AND_ASSIGN(PluginFinder);
97 }; 98 };
98 99
99 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ 100 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/chrome_metrics_helper.cc ('k') | chrome/browser/plugins/plugin_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698