| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/pepper_plugin_registry.h" | 5 #include "chrome/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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 for (size_t j = 1; j < parts.size(); ++j) | 94 for (size_t j = 1; j < parts.size(); ++j) |
| 95 plugin.mime_types.push_back(parts[j]); | 95 plugin.mime_types.push_back(parts[j]); |
| 96 | 96 |
| 97 plugins->push_back(plugin); | 97 plugins->push_back(plugin); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 // static | 101 // static |
| 102 void PepperPluginRegistry::GetExtraPlugins( | 102 void PepperPluginRegistry::GetExtraPlugins( |
| 103 std::vector<PepperPluginInfo>* plugins) { | 103 std::vector<PepperPluginInfo>* plugins) { |
| 104 #if defined(INTERNAL_PDF) |
| 104 FilePath path; | 105 FilePath path; |
| 105 // We can't check for path existance here, since we are in the sandbox. | 106 // We can't check for path existance here, since we are in the sandbox. |
| 106 // If plugin is missing, it will later fail to | 107 // If plugin is missing, it will later fail to |
| 107 // load the library and the missing plugin message will be displayed. | 108 // load the library and the missing plugin message will be displayed. |
| 108 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 109 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
| 109 PepperPluginInfo pdf; | 110 PepperPluginInfo pdf; |
| 110 pdf.path = path; | 111 pdf.path = path; |
| 111 pdf.name = "Chrome PDF Viewer"; | 112 pdf.name = "Chrome PDF Viewer"; |
| 112 pdf.mime_types.push_back("application/pdf"); | 113 pdf.mime_types.push_back("application/pdf"); |
| 113 pdf.file_extensions = "pdf"; | 114 pdf.file_extensions = "pdf"; |
| 114 pdf.type_descriptions = "Portable Document Format"; | 115 pdf.type_descriptions = "Portable Document Format"; |
| 115 plugins->push_back(pdf); | 116 plugins->push_back(pdf); |
| 116 } | 117 } |
| 118 #endif // INTERNAL_PDF |
| 117 } | 119 } |
| 118 | 120 |
| 119 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { | 121 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { |
| 120 is_internal = true; | 122 is_internal = true; |
| 121 } | 123 } |
| 122 | 124 |
| 123 // static | 125 // static |
| 124 void PepperPluginRegistry::GetInternalPluginInfo( | 126 void PepperPluginRegistry::GetInternalPluginInfo( |
| 125 InternalPluginInfoList* plugin_info) { | 127 InternalPluginInfoList* plugin_info) { |
| 126 // Currently, to centralize the internal plugin registration logic, we | 128 // Currently, to centralize the internal plugin registration logic, we |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 for (size_t i = 0; i < plugins.size(); ++i) { | 188 for (size_t i = 0; i < plugins.size(); ++i) { |
| 187 const FilePath& path = plugins[i].path; | 189 const FilePath& path = plugins[i].path; |
| 188 ModuleHandle module = pepper::PluginModule::CreateModule(path); | 190 ModuleHandle module = pepper::PluginModule::CreateModule(path); |
| 189 if (!module) { | 191 if (!module) { |
| 190 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 192 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 191 continue; | 193 continue; |
| 192 } | 194 } |
| 193 modules_[path] = module; | 195 modules_[path] = module; |
| 194 } | 196 } |
| 195 } | 197 } |
| OLD | NEW |