Chromium Code Reviews| 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 "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" |
| 11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "remoting/client/plugin/pepper_entrypoints.h" | 16 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 17 | 17 |
| 18 const char* PepperPluginRegistry::kPDFPluginName = "Chrome PDF Viewer"; | 18 const char* PepperPluginRegistry::kPDFPluginName = "Chrome PDF Viewer"; |
| 19 const char* PepperPluginRegistry::kPDFPluginMimeType = "application/pdf"; | 19 const char* PepperPluginRegistry::kPDFPluginMimeType = "application/pdf"; |
| 20 const char* PepperPluginRegistry::kPDFPluginExtension = "pdf"; | 20 const char* PepperPluginRegistry::kPDFPluginExtension = "pdf"; |
| 21 const char* PepperPluginRegistry::kPDFPluginDescription = | 21 const char* PepperPluginRegistry::kPDFPluginDescription = |
| 22 "Portable Document Format"; | 22 "Portable Document Format"; |
| 23 | 23 |
| 24 const char* PepperPluginRegistry::kNaClPluginName = "Chrome NaCl"; | 24 const char* PepperPluginRegistry::kNaClPluginName = "Chrome NaCl"; |
| 25 const char* PepperPluginRegistry::kNaClPluginMimeType = | 25 const char* PepperPluginRegistry::kNaClPluginMimeType = |
| 26 "application/x-ppapi-nacl-srpc"; | 26 "application/x-nacl"; |
|
abarth-chromium
2011/01/11 01:01:13
Much nicer!
| |
| 27 const char* PepperPluginRegistry::kNaClPluginExtension = "nexe"; | 27 const char* PepperPluginRegistry::kNaClPluginExtension = "nexe"; |
| 28 const char* PepperPluginRegistry::kNaClPluginDescription = | 28 const char* PepperPluginRegistry::kNaClPluginDescription = |
| 29 "Native Client Executable"; | 29 "Native Client Executable"; |
| 30 | 30 |
| 31 | 31 |
| 32 PepperPluginInfo::PepperPluginInfo() | 32 PepperPluginInfo::PepperPluginInfo() |
| 33 : is_internal(false), | 33 : is_internal(false), |
| 34 is_out_of_process(false) { | 34 is_out_of_process(false) { |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaCl) || | 155 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaCl) || |
| 156 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl); | 156 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl); |
| 157 | 157 |
| 158 static bool skip_nacl_file_check = false; | 158 static bool skip_nacl_file_check = false; |
| 159 if (enable_nacl && PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 159 if (enable_nacl && PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
| 160 if (skip_nacl_file_check || file_util::PathExists(path)) { | 160 if (skip_nacl_file_check || file_util::PathExists(path)) { |
| 161 PepperPluginInfo nacl; | 161 PepperPluginInfo nacl; |
| 162 nacl.path = path; | 162 nacl.path = path; |
| 163 nacl.name = kNaClPluginName; | 163 nacl.name = kNaClPluginName; |
| 164 nacl.mime_types.push_back(kNaClPluginMimeType); | 164 nacl.mime_types.push_back(kNaClPluginMimeType); |
| 165 | |
| 166 // TODO(bbudge) Remove this mime type after NaCl tree has been updated. | |
| 167 const char* kNaClPluginOldMimeType = | |
| 168 "application/x-ppapi-nacl-srpc"; | |
| 169 nacl.mime_types.push_back(kNaClPluginOldMimeType); | |
| 170 | |
| 165 nacl.file_extensions = kNaClPluginExtension; | 171 nacl.file_extensions = kNaClPluginExtension; |
| 166 nacl.type_descriptions = kNaClPluginDescription; | 172 nacl.type_descriptions = kNaClPluginDescription; |
| 167 plugins->push_back(nacl); | 173 plugins->push_back(nacl); |
| 168 | 174 |
| 169 skip_nacl_file_check = true; | 175 skip_nacl_file_check = true; |
| 170 } | 176 } |
| 171 } | 177 } |
| 172 } | 178 } |
| 173 | 179 |
| 174 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { | 180 PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 new webkit::ppapi::PluginModule(this)); | 298 new webkit::ppapi::PluginModule(this)); |
| 293 if (!module->InitAsLibrary(path)) { | 299 if (!module->InitAsLibrary(path)) { |
| 294 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 300 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 295 continue; | 301 continue; |
| 296 } | 302 } |
| 297 module->set_name(plugins[i].name); | 303 module->set_name(plugins[i].name); |
| 298 preloaded_modules_[path] = module; | 304 preloaded_modules_[path] = module; |
| 299 AddLiveModule(path, module); | 305 AddLiveModule(path, module); |
| 300 } | 306 } |
| 301 } | 307 } |
| OLD | NEW |