| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) | 50 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) |
| 51 // plugin-entry = | 51 // plugin-entry = |
| 52 // <file-path> + | 52 // <file-path> + |
| 53 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + | 53 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + |
| 54 // *1( LWS + ";" + LWS + <mime-type> ) | 54 // *1( LWS + ";" + LWS + <mime-type> ) |
| 55 std::vector<std::string> modules; | 55 std::vector<std::string> modules; |
| 56 base::SplitString(value, ',', &modules); | 56 base::SplitString(value, ',', &modules); |
| 57 | 57 |
| 58 size_t plugins_to_register = modules.size(); | 58 size_t plugins_to_register = modules.size(); |
| 59 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) { | 59 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) { |
| 60 VLOG(1) << plugins_to_register << " pepper plugins registered from" | 60 DVLOG(1) << plugins_to_register << " pepper plugins registered from" |
| 61 << " command line which exceeds the limit (maximum " | 61 << " command line which exceeds the limit (maximum " |
| 62 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)"; | 62 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)"; |
| 63 plugins_to_register = kMaxPluginsToRegisterFromCommandLine; | 63 plugins_to_register = kMaxPluginsToRegisterFromCommandLine; |
| 64 } | 64 } |
| 65 | 65 |
| 66 for (size_t i = 0; i < plugins_to_register; ++i) { | 66 for (size_t i = 0; i < plugins_to_register; ++i) { |
| 67 std::vector<std::string> parts; | 67 std::vector<std::string> parts; |
| 68 base::SplitString(modules[i], ';', &parts); | 68 base::SplitString(modules[i], ';', &parts); |
| 69 if (parts.size() < 2) { | 69 if (parts.size() < 2) { |
| 70 VLOG(1) << "Required mime-type not found"; | 70 DVLOG(1) << "Required mime-type not found"; |
| 71 continue; | 71 continue; |
| 72 } | 72 } |
| 73 | 73 |
| 74 std::vector<std::string> name_parts; | 74 std::vector<std::string> name_parts; |
| 75 base::SplitString(parts[0], '#', &name_parts); | 75 base::SplitString(parts[0], '#', &name_parts); |
| 76 | 76 |
| 77 PepperPluginInfo plugin; | 77 PepperPluginInfo plugin; |
| 78 plugin.is_out_of_process = out_of_process; | 78 plugin.is_out_of_process = out_of_process; |
| 79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 // This means we can't provide plugins from non-ASCII paths, but | 80 // This means we can't provide plugins from non-ASCII paths, but |
| 81 // since this switch is only for development I don't think that's | 81 // since this switch is only for development I don't think that's |
| 82 // too awful. | 82 // too awful. |
| 83 plugin.path = base::FilePath(base::ASCIIToUTF16(name_parts[0])); | 83 plugin.path = base::FilePath(base::ASCIIToUTF16(name_parts[0])); |
| 84 #else | 84 #else |
| 85 plugin.path = base::FilePath(name_parts[0]); | 85 plugin.path = base::FilePath(name_parts[0]); |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 uint64 index_mask = 1ULL << i; | 88 uint64 index_mask = 1ULL << i; |
| 89 if (!(skip_file_check_flags & index_mask)) { | 89 if (!(skip_file_check_flags & index_mask)) { |
| 90 if (base::PathExists(plugin.path)) { | 90 if (base::PathExists(plugin.path)) { |
| 91 skip_file_check_flags |= index_mask; | 91 skip_file_check_flags |= index_mask; |
| 92 } else { | 92 } else { |
| 93 VLOG(1) << "Plugin doesn't exist: " << plugin.path.MaybeAsASCII(); | 93 DVLOG(1) << "Plugin doesn't exist: " << plugin.path.MaybeAsASCII(); |
| 94 continue; | 94 continue; |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 if (name_parts.size() > 1) | 98 if (name_parts.size() > 1) |
| 99 plugin.name = name_parts[1]; | 99 plugin.name = name_parts[1]; |
| 100 if (name_parts.size() > 2) | 100 if (name_parts.size() > 2) |
| 101 plugin.description = name_parts[2]; | 101 plugin.description = name_parts[2]; |
| 102 if (name_parts.size() > 3) | 102 if (name_parts.size() > 3) |
| 103 plugin.version = name_parts[3]; | 103 plugin.version = name_parts[3]; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { | 147 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { |
| 148 GetContentClient()->AddPepperPlugins(plugins); | 148 GetContentClient()->AddPepperPlugins(plugins); |
| 149 ComputePluginsFromCommandLine(plugins); | 149 ComputePluginsFromCommandLine(plugins); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |