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