| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 plugin.mime_types.push_back(WideToASCII(parts[j])); | 87 plugin.mime_types.push_back(WideToASCII(parts[j])); |
| 88 | 88 |
| 89 plugins->push_back(plugin); | 89 plugins->push_back(plugin); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 void PepperPluginRegistry::GetExtraPlugins( | 94 void PepperPluginRegistry::GetExtraPlugins( |
| 95 std::vector<PepperPluginInfo>* plugins) { | 95 std::vector<PepperPluginInfo>* plugins) { |
| 96 FilePath path; | 96 FilePath path; |
| 97 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path) && | 97 // We can't check for path existance here, since we are in the sandbox. |
| 98 file_util::PathExists(path)) { | 98 // If plugin is missing, it will later fail to |
| 99 // load the library and the missing plugin message will be displayed. |
| 100 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
| 99 PepperPluginInfo pdf; | 101 PepperPluginInfo pdf; |
| 100 pdf.path = path; | 102 pdf.path = path; |
| 101 pdf.name = "Chrome PDF Viewer"; | 103 pdf.name = "Chrome PDF Viewer"; |
| 102 pdf.mime_types.push_back("application/pdf"); | 104 pdf.mime_types.push_back("application/pdf"); |
| 103 pdf.file_extensions = "pdf"; | 105 pdf.file_extensions = "pdf"; |
| 104 pdf.type_descriptions = "Portable Document Format"; | 106 pdf.type_descriptions = "Portable Document Format"; |
| 105 plugins->push_back(pdf); | 107 plugins->push_back(pdf); |
| 106 } | 108 } |
| 107 } | 109 } |
| 108 | 110 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 for (size_t i = 0; i < plugins.size(); ++i) { | 178 for (size_t i = 0; i < plugins.size(); ++i) { |
| 177 const FilePath& path = plugins[i].path; | 179 const FilePath& path = plugins[i].path; |
| 178 ModuleHandle module = pepper::PluginModule::CreateModule(path); | 180 ModuleHandle module = pepper::PluginModule::CreateModule(path); |
| 179 if (!module) { | 181 if (!module) { |
| 180 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 182 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 181 continue; | 183 continue; |
| 182 } | 184 } |
| 183 modules_[path] = module; | 185 modules_[path] = module; |
| 184 } | 186 } |
| 185 } | 187 } |
| OLD | NEW |