| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_registry.h" | 5 #include "content/common/pepper_plugin_registry.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 switches::kRegisterPepperPlugins); | 26 switches::kRegisterPepperPlugins); |
| 27 if (value.empty()) | 27 if (value.empty()) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 // FORMAT: | 30 // FORMAT: |
| 31 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) | 31 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) |
| 32 // plugin-entry = | 32 // plugin-entry = |
| 33 // <file-path> + | 33 // <file-path> + |
| 34 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + | 34 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + |
| 35 // *1( LWS + ";" + LWS + <mime-type> ) | 35 // *1( LWS + ";" + LWS + <mime-type> ) |
| 36 | |
| 37 std::vector<std::string> modules; | 36 std::vector<std::string> modules; |
| 38 base::SplitString(value, ',', &modules); | 37 base::SplitString(value, ',', &modules); |
| 39 for (size_t i = 0; i < modules.size(); ++i) { | 38 for (size_t i = 0; i < modules.size(); ++i) { |
| 40 std::vector<std::string> parts; | 39 std::vector<std::string> parts; |
| 41 base::SplitString(modules[i], ';', &parts); | 40 base::SplitString(modules[i], ';', &parts); |
| 42 if (parts.size() < 2) { | 41 if (parts.size() < 2) { |
| 43 DLOG(ERROR) << "Required mime-type not found"; | 42 DLOG(ERROR) << "Required mime-type not found"; |
| 44 continue; | 43 continue; |
| 45 } | 44 } |
| 46 | 45 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 #else | 56 #else |
| 58 plugin.path = FilePath(name_parts[0]); | 57 plugin.path = FilePath(name_parts[0]); |
| 59 #endif | 58 #endif |
| 60 if (name_parts.size() > 1) | 59 if (name_parts.size() > 1) |
| 61 plugin.name = name_parts[1]; | 60 plugin.name = name_parts[1]; |
| 62 if (name_parts.size() > 2) | 61 if (name_parts.size() > 2) |
| 63 plugin.description = name_parts[2]; | 62 plugin.description = name_parts[2]; |
| 64 if (name_parts.size() > 3) | 63 if (name_parts.size() > 3) |
| 65 plugin.version = name_parts[3]; | 64 plugin.version = name_parts[3]; |
| 66 for (size_t j = 1; j < parts.size(); ++j) { | 65 for (size_t j = 1; j < parts.size(); ++j) { |
| 67 webkit::npapi::WebPluginMimeType mime_type(parts[j], | 66 webkit::WebPluginMimeType mime_type(parts[j], |
| 68 std::string(), | 67 std::string(), |
| 69 plugin.description); | 68 plugin.description); |
| 70 plugin.mime_types.push_back(mime_type); | 69 plugin.mime_types.push_back(mime_type); |
| 71 } | 70 } |
| 72 | 71 |
| 73 plugins->push_back(plugin); | 72 plugins->push_back(plugin); |
| 74 } | 73 } |
| 75 } | 74 } |
| 76 | 75 |
| 77 } // namespace | 76 } // namespace |
| 78 | 77 |
| 79 webkit::npapi::WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const { | 78 webkit::WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const { |
| 80 webkit::npapi::WebPluginInfo info; | 79 webkit::WebPluginInfo info; |
| 81 | 80 |
| 82 info.name = name.empty() ? path.BaseName().LossyDisplayName() : | 81 info.name = name.empty() ? path.BaseName().LossyDisplayName() : |
| 83 ASCIIToUTF16(name); | 82 ASCIIToUTF16(name); |
| 84 info.path = path; | 83 info.path = path; |
| 85 info.version = ASCIIToUTF16(version); | 84 info.version = ASCIIToUTF16(version); |
| 86 info.desc = ASCIIToUTF16(description); | 85 info.desc = ASCIIToUTF16(description); |
| 87 info.mime_types = mime_types; | 86 info.mime_types = mime_types; |
| 88 | 87 |
| 89 webkit::npapi::WebPluginInfo::EnabledStates enabled_state = | 88 webkit::WebPluginInfo::EnabledStates enabled_state = |
| 90 webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; | 89 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
| 91 | 90 |
| 92 if (!enabled) { | 91 if (!enabled) { |
| 93 enabled_state = | 92 enabled_state = |
| 94 webkit::npapi::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; | 93 webkit::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; |
| 95 } | 94 } |
| 96 | 95 |
| 97 info.enabled = enabled_state; | 96 info.enabled = enabled_state; |
| 98 return info; | 97 return info; |
| 99 } | 98 } |
| 100 | 99 |
| 101 PepperPluginInfo::PepperPluginInfo() | 100 PepperPluginInfo::PepperPluginInfo() |
| 102 : is_internal(false), | 101 : is_internal(false), |
| 103 is_out_of_process(false), | 102 is_out_of_process(false), |
| 104 enabled(true) { | 103 enabled(true) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() { | 221 base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() { |
| 223 // This is called only in the renderer so we know we have a child process. | 222 // This is called only in the renderer so we know we have a child process. |
| 224 DCHECK(ChildProcess::current()) << "Must be in the renderer."; | 223 DCHECK(ChildProcess::current()) << "Must be in the renderer."; |
| 225 return ChildProcess::current()->io_message_loop_proxy(); | 224 return ChildProcess::current()->io_message_loop_proxy(); |
| 226 } | 225 } |
| 227 | 226 |
| 228 base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() { | 227 base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() { |
| 229 DCHECK(ChildProcess::current()) << "Must be in the renderer."; | 228 DCHECK(ChildProcess::current()) << "Must be in the renderer."; |
| 230 return ChildProcess::current()->GetShutDownEvent(); | 229 return ChildProcess::current()->GetShutDownEvent(); |
| 231 } | 230 } |
| OLD | NEW |