| OLD | NEW |
| 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 "content/common/pepper_plugin_list.h" | 5 #include "content/common/pepper_plugin_list.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 std::vector<std::string> name_parts; | 73 std::vector<std::string> name_parts; |
| 74 base::SplitString(parts[0], '#', &name_parts); | 74 base::SplitString(parts[0], '#', &name_parts); |
| 75 | 75 |
| 76 PepperPluginInfo plugin; | 76 PepperPluginInfo plugin; |
| 77 plugin.is_out_of_process = out_of_process; | 77 plugin.is_out_of_process = out_of_process; |
| 78 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 79 // This means we can't provide plugins from non-ASCII paths, but | 79 // This means we can't provide plugins from non-ASCII paths, but |
| 80 // since this switch is only for development I don't think that's | 80 // since this switch is only for development I don't think that's |
| 81 // too awful. | 81 // too awful. |
| 82 plugin.path = base::FilePath(ASCIIToUTF16(name_parts[0])); | 82 plugin.path = base::FilePath(base::ASCIIToUTF16(name_parts[0])); |
| 83 #else | 83 #else |
| 84 plugin.path = base::FilePath(name_parts[0]); | 84 plugin.path = base::FilePath(name_parts[0]); |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 uint64 index_mask = 1ULL << i; | 87 uint64 index_mask = 1ULL << i; |
| 88 if (!(skip_file_check_flags & index_mask)) { | 88 if (!(skip_file_check_flags & index_mask)) { |
| 89 if (base::PathExists(plugin.path)) { | 89 if (base::PathExists(plugin.path)) { |
| 90 skip_file_check_flags |= index_mask; | 90 skip_file_check_flags |= index_mask; |
| 91 } else { | 91 } else { |
| 92 VLOG(1) << "Plugin doesn't exist: " << plugin.path.MaybeAsASCII(); | 92 VLOG(1) << "Plugin doesn't exist: " << plugin.path.MaybeAsASCII(); |
| 93 continue; | 93 continue; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 if (name_parts.size() > 1) | 97 if (name_parts.size() > 1) |
| 98 plugin.name = name_parts[1]; | 98 plugin.name = name_parts[1]; |
| 99 if (name_parts.size() > 2) | 99 if (name_parts.size() > 2) |
| 100 plugin.description = name_parts[2]; | 100 plugin.description = name_parts[2]; |
| 101 if (name_parts.size() > 3) | 101 if (name_parts.size() > 3) |
| 102 plugin.version = name_parts[3]; | 102 plugin.version = name_parts[3]; |
| 103 for (size_t j = 1; j < parts.size(); ++j) { | 103 for (size_t j = 1; j < parts.size(); ++j) { |
| 104 WebPluginMimeType mime_type(parts[j], | 104 WebPluginMimeType mime_type(parts[j], |
| 105 std::string(), | 105 std::string(), |
| 106 plugin.description); | 106 plugin.description); |
| 107 plugin.mime_types.push_back(mime_type); | 107 plugin.mime_types.push_back(mime_type); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // If the plugin name is empty, use the filename. | 110 // If the plugin name is empty, use the filename. |
| 111 if (plugin.name.empty()) | 111 if (plugin.name.empty()) { |
| 112 plugin.name = UTF16ToUTF8(plugin.path.BaseName().LossyDisplayName()); | 112 plugin.name = |
| 113 base::UTF16ToUTF8(plugin.path.BaseName().LossyDisplayName()); |
| 114 } |
| 113 | 115 |
| 114 // Command-line plugins get full permissions. | 116 // Command-line plugins get full permissions. |
| 115 plugin.permissions = ppapi::PERMISSION_ALL_BITS; | 117 plugin.permissions = ppapi::PERMISSION_ALL_BITS; |
| 116 | 118 |
| 117 plugins->push_back(plugin); | 119 plugins->push_back(plugin); |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 | 122 |
| 121 } // namespace | 123 } // namespace |
| 122 | 124 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 140 | 142 |
| 141 return true; | 143 return true; |
| 142 } | 144 } |
| 143 | 145 |
| 144 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { | 146 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { |
| 145 GetContentClient()->AddPepperPlugins(plugins); | 147 GetContentClient()->AddPepperPlugins(plugins); |
| 146 ComputePluginsFromCommandLine(plugins); | 148 ComputePluginsFromCommandLine(plugins); |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace content | 151 } // namespace content |
| OLD | NEW |