Chromium Code Reviews| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Once we're sandboxed, we can't know if the PDF plugin is | 104 // Once we're sandboxed, we can't know if the PDF plugin is |
| 105 // available or not; but (on Linux) this function is always called | 105 // available or not; but (on Linux) this function is always called |
| 106 // once before we're sandboxed. So the first time through test if | 106 // once before we're sandboxed. So the first time through test if |
| 107 // the file is available and then skip the check on subsequent calls | 107 // the file is available and then skip the check on subsequent calls |
| 108 // if not. | 108 // if yes. |
| 109 static bool skip_pdf_plugin = false; | 109 static bool skip_pdf_file_check = false; |
| 110 FilePath path; | 110 FilePath path; |
| 111 if (!skip_pdf_plugin && PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 111 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
| 112 if (!file_util::PathExists(path)) { | 112 if (skip_pdf_file_check || file_util::PathExists(path)) { |
|
viettrungluu
2010/08/11 19:34:34
This isn't good for Chromium, since it'll result i
Evan Martin
2010/08/11 19:39:51
PathExists doesn't spew.
| |
| 113 skip_pdf_plugin = true; | 113 PepperPluginInfo pdf; |
| 114 return; | 114 pdf.path = path; |
| 115 pdf.name = "Chrome PDF Viewer"; | |
| 116 pdf.mime_types.push_back("application/pdf"); | |
| 117 pdf.file_extensions = "pdf"; | |
| 118 pdf.type_descriptions = "Portable Document Format"; | |
| 119 plugins->push_back(pdf); | |
| 120 | |
| 121 skip_pdf_file_check = true; | |
| 115 } | 122 } |
| 116 | |
| 117 PepperPluginInfo pdf; | |
| 118 pdf.path = path; | |
| 119 pdf.name = "Chrome PDF Viewer"; | |
| 120 pdf.mime_types.push_back("application/pdf"); | |
| 121 pdf.file_extensions = "pdf"; | |
| 122 pdf.type_descriptions = "Portable Document Format"; | |
| 123 plugins->push_back(pdf); | |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 | 125 |
| 127 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { | 126 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { |
| 128 is_internal = true; | 127 is_internal = true; |
| 129 } | 128 } |
| 130 | 129 |
| 131 // static | 130 // static |
| 132 void PepperPluginRegistry::GetInternalPluginInfo( | 131 void PepperPluginRegistry::GetInternalPluginInfo( |
| 133 InternalPluginInfoList* plugin_info) { | 132 InternalPluginInfoList* plugin_info) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 for (size_t i = 0; i < plugins.size(); ++i) { | 193 for (size_t i = 0; i < plugins.size(); ++i) { |
| 195 const FilePath& path = plugins[i].path; | 194 const FilePath& path = plugins[i].path; |
| 196 ModuleHandle module = pepper::PluginModule::CreateModule(path); | 195 ModuleHandle module = pepper::PluginModule::CreateModule(path); |
| 197 if (!module) { | 196 if (!module) { |
| 198 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 197 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 199 continue; | 198 continue; |
| 200 } | 199 } |
| 201 modules_[path] = module; | 200 modules_[path] = module; |
| 202 } | 201 } |
| 203 } | 202 } |
| OLD | NEW |