| 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" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/common/child_process_logging.h" | 18 #include "chrome/common/child_process_logging.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/chrome_version_info.h" | 21 #include "chrome/common/chrome_version_info.h" |
| 22 #include "chrome/common/pepper_flash.h" | 22 #include "chrome/common/pepper_flash.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/pepper_plugin_info.h" | 26 #include "content/public/common/pepper_plugin_info.h" |
| 27 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
| 28 #include "grit/common_resources.h" | 28 #include "grit/common_resources.h" |
| 29 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 29 #include "remoting/client/plugin/pepper_entrypoints.h" | 30 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/layout.h" | 32 #include "ui/base/layout.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "webkit/glue/user_agent.h" | 34 #include "webkit/glue/user_agent.h" |
| 34 #include "webkit/plugins/npapi/plugin_list.h" | 35 #include "webkit/plugins/npapi/plugin_list.h" |
| 35 #include "webkit/plugins/plugin_constants.h" | 36 #include "webkit/plugins/plugin_constants.h" |
| 36 | 37 |
| 37 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 38 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 38 | 39 |
| 39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 40 #include "base/win/registry.h" | 41 #include "base/win/registry.h" |
| 41 #include "base/win/windows_version.h" | 42 #include "base/win/windows_version.h" |
| 42 #include "sandbox/src/sandbox.h" | 43 #include "sandbox/src/sandbox.h" |
| 43 #elif defined(OS_MACOSX) | 44 #elif defined(OS_MACOSX) |
| 44 #include "chrome/common/chrome_sandbox_type_mac.h" | 45 #include "chrome/common/chrome_sandbox_type_mac.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 const char kPDFPluginName[] = "Chrome PDF Viewer"; | 50 const char kPDFPluginName[] = "Chrome PDF Viewer"; |
| 50 const char kPDFPluginMimeType[] = "application/pdf"; | 51 const char kPDFPluginMimeType[] = "application/pdf"; |
| 51 const char kPDFPluginExtension[] = "pdf"; | 52 const char kPDFPluginExtension[] = "pdf"; |
| 52 const char kPDFPluginDescription[] = "Portable Document Format"; | 53 const char kPDFPluginDescription[] = "Portable Document Format"; |
| 53 const char kPDFPluginPrintPreviewMimeType | 54 const char kPDFPluginPrintPreviewMimeType |
| 54 [] = "application/x-google-chrome-print-preview-pdf"; | 55 [] = "application/x-google-chrome-print-preview-pdf"; |
| 56 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 57 ppapi::PERMISSION_DEV; |
| 55 | 58 |
| 56 const char kNaClPluginName[] = "Native Client"; | 59 const char kNaClPluginName[] = "Native Client"; |
| 57 const char kNaClPluginMimeType[] = "application/x-nacl"; | 60 const char kNaClPluginMimeType[] = "application/x-nacl"; |
| 58 const char kNaClPluginExtension[] = "nexe"; | 61 const char kNaClPluginExtension[] = "nexe"; |
| 59 const char kNaClPluginDescription[] = "Native Client Executable"; | 62 const char kNaClPluginDescription[] = "Native Client Executable"; |
| 63 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 64 ppapi::PERMISSION_DEV; |
| 60 | 65 |
| 61 const char kNaClOldPluginName[] = "Chrome NaCl"; | 66 const char kNaClOldPluginName[] = "Chrome NaCl"; |
| 62 | 67 |
| 63 const char kO3DPluginName[] = "Google Talk Plugin Video Accelerator"; | 68 const char kO3DPluginName[] = "Google Talk Plugin Video Accelerator"; |
| 64 const char kO3DPluginMimeType[] ="application/vnd.o3d.auto"; | 69 const char kO3DPluginMimeType[] ="application/vnd.o3d.auto"; |
| 65 const char kO3DPluginExtension[] = ""; | 70 const char kO3DPluginExtension[] = ""; |
| 66 const char kO3DPluginDescription[] = "O3D MIME"; | 71 const char kO3DPluginDescription[] = "O3D MIME"; |
| 67 | 72 |
| 68 const char kGTalkPluginName[] = "Google Talk Plugin"; | 73 const char kGTalkPluginName[] = "Google Talk Plugin"; |
| 69 const char kGTalkPluginMimeType[] ="application/googletalk"; | 74 const char kGTalkPluginMimeType[] ="application/googletalk"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 100 pdf.name = kPDFPluginName; | 105 pdf.name = kPDFPluginName; |
| 101 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | 106 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
| 102 kPDFPluginExtension, | 107 kPDFPluginExtension, |
| 103 kPDFPluginDescription); | 108 kPDFPluginDescription); |
| 104 webkit::WebPluginMimeType print_preview_pdf_mime_type( | 109 webkit::WebPluginMimeType print_preview_pdf_mime_type( |
| 105 kPDFPluginPrintPreviewMimeType, | 110 kPDFPluginPrintPreviewMimeType, |
| 106 kPDFPluginExtension, | 111 kPDFPluginExtension, |
| 107 kPDFPluginDescription); | 112 kPDFPluginDescription); |
| 108 pdf.mime_types.push_back(pdf_mime_type); | 113 pdf.mime_types.push_back(pdf_mime_type); |
| 109 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 114 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
| 115 pdf.permissions = kPDFPluginPermissions; |
| 110 plugins->push_back(pdf); | 116 plugins->push_back(pdf); |
| 111 | 117 |
| 112 skip_pdf_file_check = true; | 118 skip_pdf_file_check = true; |
| 113 } | 119 } |
| 114 } | 120 } |
| 115 | 121 |
| 116 // Handle the Native Client just like the PDF plugin. This means that it is | 122 // Handle the Native Client just like the PDF plugin. This means that it is |
| 117 // enabled by default. This allows apps installed from the Chrome Web Store | 123 // enabled by default. This allows apps installed from the Chrome Web Store |
| 118 // to use NaCl even if the command line switch isn't set. For other uses of | 124 // to use NaCl even if the command line switch isn't set. For other uses of |
| 119 // NaCl we check for the command line switch. | 125 // NaCl we check for the command line switch. |
| 120 static bool skip_nacl_file_check = false; | 126 static bool skip_nacl_file_check = false; |
| 121 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 127 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
| 122 if (skip_nacl_file_check || file_util::PathExists(path)) { | 128 if (skip_nacl_file_check || file_util::PathExists(path)) { |
| 123 content::PepperPluginInfo nacl; | 129 content::PepperPluginInfo nacl; |
| 124 nacl.path = path; | 130 nacl.path = path; |
| 125 nacl.name = kNaClPluginName; | 131 nacl.name = kNaClPluginName; |
| 126 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 132 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
| 127 kNaClPluginExtension, | 133 kNaClPluginExtension, |
| 128 kNaClPluginDescription); | 134 kNaClPluginDescription); |
| 129 nacl.mime_types.push_back(nacl_mime_type); | 135 nacl.mime_types.push_back(nacl_mime_type); |
| 136 nacl.permissions = kNaClPluginPermissions; |
| 130 plugins->push_back(nacl); | 137 plugins->push_back(nacl); |
| 131 | 138 |
| 132 skip_nacl_file_check = true; | 139 skip_nacl_file_check = true; |
| 133 } | 140 } |
| 134 } | 141 } |
| 135 | 142 |
| 136 static bool skip_o3d_file_check = false; | 143 static bool skip_o3d_file_check = false; |
| 137 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { | 144 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { |
| 138 if (skip_o3d_file_check || file_util::PathExists(path)) { | 145 if (skip_o3d_file_check || file_util::PathExists(path)) { |
| 139 content::PepperPluginInfo o3d; | 146 content::PepperPluginInfo o3d; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 521 |
| 515 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( | 522 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( |
| 516 content::PepperPluginInfo* plugin, | 523 content::PepperPluginInfo* plugin, |
| 517 bool* override_npapi_flash) { | 524 bool* override_npapi_flash) { |
| 518 if (!ConductingPepperFlashFieldTrial()) | 525 if (!ConductingPepperFlashFieldTrial()) |
| 519 return false; | 526 return false; |
| 520 return GetBundledPepperFlash(plugin, override_npapi_flash); | 527 return GetBundledPepperFlash(plugin, override_npapi_flash); |
| 521 } | 528 } |
| 522 | 529 |
| 523 } // namespace chrome | 530 } // namespace chrome |
| OLD | NEW |