OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac/mac_util.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "webkit/plugins/npapi/plugin_lib.h" | 15 #include "webkit/plugins/npapi/plugin_lib.h" |
16 | 16 |
17 namespace webkit { | 17 namespace webkit { |
18 namespace npapi { | 18 namespace npapi { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, | 22 void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, |
23 bool user) { | 23 bool user) { |
24 // Note that there are no NSSearchPathDirectory constants for these | 24 // Note that there are no NSSearchPathDirectory constants for these |
25 // directories so we can't use Cocoa's NSSearchPathForDirectoriesInDomains(). | 25 // directories so we can't use Cocoa's NSSearchPathForDirectoriesInDomains(). |
26 // Interestingly, Safari hard-codes the location (see | 26 // Interestingly, Safari hard-codes the location (see |
27 // WebKit/WebKit/mac/Plugins/WebPluginDatabase.mm's +_defaultPlugInPaths). | 27 // WebKit/WebKit/mac/Plugins/WebPluginDatabase.mm's +_defaultPlugInPaths). |
28 FSRef ref; | 28 FSRef ref; |
29 OSErr err = FSFindFolder(user ? kUserDomain : kLocalDomain, | 29 OSErr err = FSFindFolder(user ? kUserDomain : kLocalDomain, |
30 kInternetPlugInFolderType, false, &ref); | 30 kInternetPlugInFolderType, false, &ref); |
31 | 31 |
32 if (err) | 32 if (err) |
33 return; | 33 return; |
34 | 34 |
35 plugin_dirs->push_back(FilePath(mac_util::PathFromFSRef(ref))); | 35 plugin_dirs->push_back(FilePath(base::mac::PathFromFSRef(ref))); |
36 } | 36 } |
37 | 37 |
38 // Returns true if the plugin should be prevented from loading. | 38 // Returns true if the plugin should be prevented from loading. |
39 bool IsBlacklistedPlugin(const WebPluginInfo& info) { | 39 bool IsBlacklistedPlugin(const WebPluginInfo& info) { |
40 // We blacklist Gears by included MIME type, since that is more stable than | 40 // We blacklist Gears by included MIME type, since that is more stable than |
41 // its name. Be careful about adding any more plugins to this list though, | 41 // its name. Be careful about adding any more plugins to this list though, |
42 // since it's easy to accidentally blacklist plugins that support lots of | 42 // since it's easy to accidentally blacklist plugins that support lots of |
43 // MIME types. | 43 // MIME types. |
44 for (std::vector<WebPluginMimeType>::const_iterator i = | 44 for (std::vector<WebPluginMimeType>::const_iterator i = |
45 info.mime_types.begin(); i != info.mime_types.end(); ++i) { | 45 info.mime_types.begin(); i != info.mime_types.end(); ++i) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if ((*plugins)[i].path.BaseName() == info.path.BaseName()) { | 101 if ((*plugins)[i].path.BaseName() == info.path.BaseName()) { |
102 return false; // We already have a loaded plugin higher in the hierarchy. | 102 return false; // We already have a loaded plugin higher in the hierarchy. |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
109 } // namespace npapi | 109 } // namespace npapi |
110 } // namespace webkit | 110 } // namespace webkit |
OLD | NEW |