Chromium Code Reviews
Help | Chromium Project | Sign in
(50)

Side by Side Diff: chrome/common/pepper_plugin_registry.cc

Issue 3114005: pepper: don't warn if PDF plugin is unavailable (Closed)
Patch Set: arg Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Once we're sandboxed, we can't know if the PDF plugin is
105 // available or not; but this function is always called once before
106 // we're sandboxed. So the first time through test if the file is
107 // available and then skip the check on subsequent calls if not.
108 static bool skip_pdf_plugin = false;
104 FilePath path; 109 FilePath path;
105 // We can't check for path existance here, since we are in the sandbox. 110 if (!skip_pdf_plugin && PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
106 // If plugin is missing, it will later fail to 111 if (!file_util::PathExists(path)) {
107 // load the library and the missing plugin message will be displayed. 112 skip_pdf_plugin = true;
108 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { 113 return;
114 }
115
109 PepperPluginInfo pdf; 116 PepperPluginInfo pdf;
110 pdf.path = path; 117 pdf.path = path;
111 pdf.name = "Chrome PDF Viewer"; 118 pdf.name = "Chrome PDF Viewer";
112 pdf.mime_types.push_back("application/pdf"); 119 pdf.mime_types.push_back("application/pdf");
113 pdf.file_extensions = "pdf"; 120 pdf.file_extensions = "pdf";
114 pdf.type_descriptions = "Portable Document Format"; 121 pdf.type_descriptions = "Portable Document Format";
115 plugins->push_back(pdf); 122 plugins->push_back(pdf);
116 } 123 }
117 } 124 }
118 125
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 for (size_t i = 0; i < plugins.size(); ++i) { 193 for (size_t i = 0; i < plugins.size(); ++i) {
187 const FilePath& path = plugins[i].path; 194 const FilePath& path = plugins[i].path;
188 ModuleHandle module = pepper::PluginModule::CreateModule(path); 195 ModuleHandle module = pepper::PluginModule::CreateModule(path);
189 if (!module) { 196 if (!module) {
190 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); 197 DLOG(ERROR) << "Failed to load pepper module: " << path.value();
191 continue; 198 continue;
192 } 199 }
193 modules_[path] = module; 200 modules_[path] = module;
194 } 201 }
195 } 202 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld ec887be