OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/cpu.h" | 8 #include "base/cpu.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 const char kPDFPluginMimeType[] = "application/pdf"; | 59 const char kPDFPluginMimeType[] = "application/pdf"; |
60 const char kPDFPluginExtension[] = "pdf"; | 60 const char kPDFPluginExtension[] = "pdf"; |
61 const char kPDFPluginDescription[] = "Portable Document Format"; | 61 const char kPDFPluginDescription[] = "Portable Document Format"; |
62 const char kPDFPluginPrintPreviewMimeType | 62 const char kPDFPluginPrintPreviewMimeType |
63 [] = "application/x-google-chrome-print-preview-pdf"; | 63 [] = "application/x-google-chrome-print-preview-pdf"; |
64 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | | 64 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
65 ppapi::PERMISSION_DEV; | 65 ppapi::PERMISSION_DEV; |
66 | 66 |
67 const char kNaClPluginMimeType[] = "application/x-nacl"; | 67 const char kNaClPluginMimeType[] = "application/x-nacl"; |
68 const char kNaClPluginExtension[] = "nexe"; | 68 const char kNaClPluginExtension[] = ""; |
69 const char kNaClPluginDescription[] = "Native Client Executable"; | 69 const char kNaClPluginDescription[] = "Native Client Executable"; |
70 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | | 70 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | |
71 ppapi::PERMISSION_DEV; | 71 ppapi::PERMISSION_DEV; |
72 | 72 |
| 73 const char kPnaclPluginMimeType[] = "application/x-pnacl"; |
| 74 const char kPnaclPluginExtension[] = ""; |
| 75 const char kPnaclPluginDescription[] = "Portable Native Client Executable"; |
| 76 const uint32 kPnaclPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 77 ppapi::PERMISSION_DEV; |
| 78 |
73 const char kO3DPluginName[] = "Google Talk Plugin Video Accelerator"; | 79 const char kO3DPluginName[] = "Google Talk Plugin Video Accelerator"; |
74 const char kO3DPluginMimeType[] ="application/vnd.o3d.auto"; | 80 const char kO3DPluginMimeType[] ="application/vnd.o3d.auto"; |
75 const char kO3DPluginExtension[] = ""; | 81 const char kO3DPluginExtension[] = ""; |
76 const char kO3DPluginDescription[] = "O3D MIME"; | 82 const char kO3DPluginDescription[] = "O3D MIME"; |
77 const uint32 kO3DPluginPermissions = ppapi::PERMISSION_PRIVATE | | 83 const uint32 kO3DPluginPermissions = ppapi::PERMISSION_PRIVATE | |
78 ppapi::PERMISSION_DEV; | 84 ppapi::PERMISSION_DEV; |
79 | 85 |
80 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; | 86 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; |
81 const char kO1DPluginMimeType[] ="application/o1d"; | 87 const char kO1DPluginMimeType[] ="application/o1d"; |
82 const char kO1DPluginExtension[] = ""; | 88 const char kO1DPluginExtension[] = ""; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 kPDFPluginDescription); | 150 kPDFPluginDescription); |
145 pdf.mime_types.push_back(pdf_mime_type); | 151 pdf.mime_types.push_back(pdf_mime_type); |
146 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 152 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
147 pdf.permissions = kPDFPluginPermissions; | 153 pdf.permissions = kPDFPluginPermissions; |
148 plugins->push_back(pdf); | 154 plugins->push_back(pdf); |
149 | 155 |
150 skip_pdf_file_check = true; | 156 skip_pdf_file_check = true; |
151 } | 157 } |
152 } | 158 } |
153 | 159 |
154 // Handle the Native Client just like the PDF plugin. This means that it is | 160 // Handle Native Client just like the PDF plugin. This means that it is |
155 // enabled by default. This allows apps installed from the Chrome Web Store | 161 // enabled by default for the non-portable case. This allows apps installed |
156 // to use NaCl even if the command line switch isn't set. For other uses of | 162 // from the Chrome Web Store to use NaCl even if the command line switch |
157 // NaCl we check for the command line switch. | 163 // isn't set. For other uses of NaCl we check for the command line switch. |
| 164 // Specifically, Portable Native Client is only enabled by the command line |
| 165 // switch. |
158 static bool skip_nacl_file_check = false; | 166 static bool skip_nacl_file_check = false; |
159 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 167 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
160 if (skip_nacl_file_check || file_util::PathExists(path)) { | 168 if (skip_nacl_file_check || file_util::PathExists(path)) { |
161 content::PepperPluginInfo nacl; | 169 content::PepperPluginInfo nacl; |
162 nacl.path = path; | 170 nacl.path = path; |
163 nacl.name = chrome::ChromeContentClient::kNaClPluginName; | 171 nacl.name = chrome::ChromeContentClient::kNaClPluginName; |
164 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 172 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
165 kNaClPluginExtension, | 173 kNaClPluginExtension, |
166 kNaClPluginDescription); | 174 kNaClPluginDescription); |
167 nacl.mime_types.push_back(nacl_mime_type); | 175 nacl.mime_types.push_back(nacl_mime_type); |
| 176 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl)) { |
| 177 webkit::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
| 178 kPnaclPluginExtension, |
| 179 kPnaclPluginDescription); |
| 180 nacl.mime_types.push_back(pnacl_mime_type); |
| 181 } |
168 nacl.permissions = kNaClPluginPermissions; | 182 nacl.permissions = kNaClPluginPermissions; |
169 plugins->push_back(nacl); | 183 plugins->push_back(nacl); |
170 | 184 |
171 skip_nacl_file_check = true; | 185 skip_nacl_file_check = true; |
172 } | 186 } |
173 } | 187 } |
174 | 188 |
175 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced | 189 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced |
176 // entirely with o1d. | 190 // entirely with o1d. |
177 static bool skip_o3d_file_check = false; | 191 static bool skip_o3d_file_check = false; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 497 } |
484 return false; | 498 return false; |
485 } | 499 } |
486 | 500 |
487 std::string ChromeContentClient::GetCarbonInterposePath() const { | 501 std::string ChromeContentClient::GetCarbonInterposePath() const { |
488 return std::string(kInterposeLibraryPath); | 502 return std::string(kInterposeLibraryPath); |
489 } | 503 } |
490 #endif | 504 #endif |
491 | 505 |
492 } // namespace chrome | 506 } // namespace chrome |
OLD | NEW |