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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 plugins->push_back(pdf); | 162 plugins->push_back(pdf); |
163 | 163 |
164 skip_pdf_file_check = true; | 164 skip_pdf_file_check = true; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 // Handle Native Client just like the PDF plugin. This means that it is | 168 // Handle Native Client just like the PDF plugin. This means that it is |
169 // enabled by default for the non-portable case. This allows apps installed | 169 // enabled by default for the non-portable case. This allows apps installed |
170 // from the Chrome Web Store to use NaCl even if the command line switch | 170 // from the Chrome Web Store to use NaCl even if the command line switch |
171 // isn't set. For other uses of NaCl we check for the command line switch. | 171 // isn't set. For other uses of NaCl we check for the command line switch. |
172 // Specifically, Portable Native Client is only enabled by the command line | |
173 // switch. | |
174 static bool skip_nacl_file_check = false; | 172 static bool skip_nacl_file_check = false; |
175 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 173 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
176 if (skip_nacl_file_check || base::PathExists(path)) { | 174 if (skip_nacl_file_check || base::PathExists(path)) { |
177 content::PepperPluginInfo nacl; | 175 content::PepperPluginInfo nacl; |
178 nacl.path = path; | 176 nacl.path = path; |
179 nacl.name = ChromeContentClient::kNaClPluginName; | 177 nacl.name = ChromeContentClient::kNaClPluginName; |
180 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 178 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
181 kNaClPluginExtension, | 179 kNaClPluginExtension, |
182 kNaClPluginDescription); | 180 kNaClPluginDescription); |
183 nacl.mime_types.push_back(nacl_mime_type); | 181 nacl.mime_types.push_back(nacl_mime_type); |
184 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 182 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
185 switches::kDisablePnacl)) { | 183 kPnaclPluginExtension, |
186 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, | 184 kPnaclPluginDescription); |
187 kPnaclPluginExtension, | 185 nacl.mime_types.push_back(pnacl_mime_type); |
188 kPnaclPluginDescription); | |
189 nacl.mime_types.push_back(pnacl_mime_type); | |
190 } | |
191 nacl.permissions = kNaClPluginPermissions; | 186 nacl.permissions = kNaClPluginPermissions; |
192 plugins->push_back(nacl); | 187 plugins->push_back(nacl); |
193 | 188 |
194 skip_nacl_file_check = true; | 189 skip_nacl_file_check = true; |
195 } | 190 } |
196 } | 191 } |
197 | 192 |
198 static bool skip_o1d_file_check = false; | 193 static bool skip_o1d_file_check = false; |
199 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { | 194 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { |
200 if (skip_o1d_file_check || base::PathExists(path)) { | 195 if (skip_o1d_file_check || base::PathExists(path)) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 int sandbox_type, | 527 int sandbox_type, |
533 int* sandbox_profile_resource_id) const { | 528 int* sandbox_profile_resource_id) const { |
534 DCHECK(sandbox_profile_resource_id); | 529 DCHECK(sandbox_profile_resource_id); |
535 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { | 530 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { |
536 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 531 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
537 return true; | 532 return true; |
538 } | 533 } |
539 return false; | 534 return false; |
540 } | 535 } |
541 #endif | 536 #endif |
OLD | NEW |