| 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/glue/plugins/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_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/glue/plugins/plugin_lib.h" | 15 #include "webkit/plugins/npapi/plugin_lib.h" |
| 16 |
| 17 namespace webkit { |
| 18 namespace npapi { |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, | 22 void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, |
| 20 bool user) { | 23 bool user) { |
| 21 // Note that there are no NSSearchPathDirectory constants for these | 24 // Note that there are no NSSearchPathDirectory constants for these |
| 22 // directories so we can't use Cocoa's NSSearchPathForDirectoriesInDomains(). | 25 // directories so we can't use Cocoa's NSSearchPathForDirectoriesInDomains(). |
| 23 // Interestingly, Safari hard-codes the location (see | 26 // Interestingly, Safari hard-codes the location (see |
| 24 // WebKit/WebKit/mac/Plugins/WebPluginDatabase.mm's +_defaultPlugInPaths). | 27 // WebKit/WebKit/mac/Plugins/WebPluginDatabase.mm's +_defaultPlugInPaths). |
| 25 FSRef ref; | 28 FSRef ref; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 return (components.size() >= 3 && | 58 return (components.size() >= 3 && |
| 56 base::StringToInt(components[2], &bugfix_version) && | 59 base::StringToInt(components[2], &bugfix_version) && |
| 57 bugfix_version < 6); | 60 bugfix_version < 6); |
| 58 } | 61 } |
| 59 | 62 |
| 60 return false; | 63 return false; |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace | 66 } // namespace |
| 64 | 67 |
| 65 namespace NPAPI | |
| 66 { | |
| 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<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 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 99 // encounter earlier must override plugins we encounter later) | 99 // encounter earlier must override plugins we encounter later) |
| 100 for (size_t i = 0; i < plugins->size(); ++i) { | 100 for (size_t i = 0; i < plugins->size(); ++i) { |
| 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 |
| OLD | NEW |