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