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

Side by Side Diff: webkit/plugins/npapi/plugin_list_mac.mm

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « webkit/plugins/npapi/plugin_list.cc ('k') | webkit/plugins/npapi/plugin_list_posix.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 #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/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<base::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(base::mac::PathFromFSRef(ref))); 35 plugin_dirs->push_back(base::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 15 matching lines...) Expand all
61 } 61 }
62 62
63 return false; 63 return false;
64 } 64 }
65 65
66 } // namespace 66 } // namespace
67 67
68 void PluginList::PlatformInit() { 68 void PluginList::PlatformInit() {
69 } 69 }
70 70
71 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { 71 void PluginList::GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs) {
72 // Load from the user's area 72 // Load from the user's area
73 GetPluginCommonDirectory(plugin_dirs, true); 73 GetPluginCommonDirectory(plugin_dirs, true);
74 74
75 // Load from the machine-wide area 75 // Load from the machine-wide area
76 GetPluginCommonDirectory(plugin_dirs, false); 76 GetPluginCommonDirectory(plugin_dirs, false);
77 } 77 }
78 78
79 void PluginList::GetPluginsInDir( 79 void PluginList::GetPluginsInDir(
80 const FilePath& path, std::vector<FilePath>* plugins) { 80 const base::FilePath& path, std::vector<base::FilePath>* plugins) {
81 file_util::FileEnumerator enumerator(path, 81 file_util::FileEnumerator enumerator(path,
82 false, // not recursive 82 false, // not recursive
83 file_util::FileEnumerator::DIRECTORIES); 83 file_util::FileEnumerator::DIRECTORIES);
84 for (FilePath path = enumerator.Next(); !path.value().empty(); 84 for (base::FilePath path = enumerator.Next(); !path.value().empty();
85 path = enumerator.Next()) { 85 path = enumerator.Next()) {
86 plugins->push_back(path); 86 plugins->push_back(path);
87 } 87 }
88 } 88 }
89 89
90 bool PluginList::ShouldLoadPluginUsingPluginList( 90 bool PluginList::ShouldLoadPluginUsingPluginList(
91 const WebPluginInfo& info, 91 const WebPluginInfo& info,
92 std::vector<webkit::WebPluginInfo>* plugins) { 92 std::vector<webkit::WebPluginInfo>* plugins) {
93 return !IsBlacklistedPlugin(info); 93 return !IsBlacklistedPlugin(info);
94 } 94 }
95 95
96 } // namespace npapi 96 } // namespace npapi
97 } // namespace webkit 97 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list.cc ('k') | webkit/plugins/npapi/plugin_list_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698