OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // but (on Linux) this function is always called once before we're sandboxed. | 78 // but (on Linux) this function is always called once before we're sandboxed. |
79 // So the first time through test if the file is available and then skip the | 79 // So the first time through test if the file is available and then skip the |
80 // check on subsequent calls if yes. | 80 // check on subsequent calls if yes. |
81 static bool skip_pdf_file_check = false; | 81 static bool skip_pdf_file_check = false; |
82 FilePath path; | 82 FilePath path; |
83 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 83 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
84 if (skip_pdf_file_check || file_util::PathExists(path)) { | 84 if (skip_pdf_file_check || file_util::PathExists(path)) { |
85 PepperPluginInfo pdf; | 85 PepperPluginInfo pdf; |
86 pdf.path = path; | 86 pdf.path = path; |
87 pdf.name = kPDFPluginName; | 87 pdf.name = kPDFPluginName; |
88 webkit::npapi::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | 88 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
89 kPDFPluginExtension, | 89 kPDFPluginExtension, |
90 kPDFPluginDescription); | 90 kPDFPluginDescription); |
91 webkit::npapi::WebPluginMimeType print_preview_pdf_mime_type( | 91 webkit::WebPluginMimeType print_preview_pdf_mime_type( |
92 kPDFPluginPrintPreviewMimeType, | 92 kPDFPluginPrintPreviewMimeType, |
93 kPDFPluginExtension, | 93 kPDFPluginExtension, |
94 kPDFPluginDescription); | 94 kPDFPluginDescription); |
95 pdf.mime_types.push_back(pdf_mime_type); | 95 pdf.mime_types.push_back(pdf_mime_type); |
96 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 96 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
97 plugins->push_back(pdf); | 97 plugins->push_back(pdf); |
98 | 98 |
99 skip_pdf_file_check = true; | 99 skip_pdf_file_check = true; |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 // Handle the Native Client just like the PDF plugin. This means that it is | 103 // Handle the Native Client just like the PDF plugin. This means that it is |
104 // enabled by default. This allows apps installed from the Chrome Web Store | 104 // enabled by default. This allows apps installed from the Chrome Web Store |
105 // to use NaCl even if the command line switch isn't set. For other uses of | 105 // to use NaCl even if the command line switch isn't set. For other uses of |
106 // NaCl we check for the command line switch. | 106 // NaCl we check for the command line switch. |
107 static bool skip_nacl_file_check = false; | 107 static bool skip_nacl_file_check = false; |
108 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 108 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
109 if (skip_nacl_file_check || file_util::PathExists(path)) { | 109 if (skip_nacl_file_check || file_util::PathExists(path)) { |
110 PepperPluginInfo nacl; | 110 PepperPluginInfo nacl; |
111 nacl.path = path; | 111 nacl.path = path; |
112 nacl.name = kNaClPluginName; | 112 nacl.name = kNaClPluginName; |
113 webkit::npapi::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 113 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
114 kNaClPluginExtension, | 114 kNaClPluginExtension, |
115 kNaClPluginDescription); | 115 kNaClPluginDescription); |
116 nacl.mime_types.push_back(nacl_mime_type); | 116 nacl.mime_types.push_back(nacl_mime_type); |
117 plugins->push_back(nacl); | 117 plugins->push_back(nacl); |
118 | 118 |
119 skip_nacl_file_check = true; | 119 skip_nacl_file_check = true; |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 // The Remoting Viewer plugin is built-in. | 123 // The Remoting Viewer plugin is built-in. |
124 #if defined(ENABLE_REMOTING) | 124 #if defined(ENABLE_REMOTING) |
125 PepperPluginInfo info; | 125 PepperPluginInfo info; |
126 info.is_internal = true; | 126 info.is_internal = true; |
127 info.name = kRemotingViewerPluginName; | 127 info.name = kRemotingViewerPluginName; |
128 info.path = FilePath(kRemotingViewerPluginPath); | 128 info.path = FilePath(kRemotingViewerPluginPath); |
129 webkit::npapi::WebPluginMimeType remoting_mime_type( | 129 webkit::WebPluginMimeType remoting_mime_type( |
130 kRemotingViewerPluginMimeType, | 130 kRemotingViewerPluginMimeType, |
131 std::string(), | 131 std::string(), |
132 std::string()); | 132 std::string()); |
133 info.mime_types.push_back(remoting_mime_type); | 133 info.mime_types.push_back(remoting_mime_type); |
134 webkit::npapi::WebPluginMimeType old_remoting_mime_type( | 134 webkit::WebPluginMimeType old_remoting_mime_type( |
135 kRemotingViewerPluginOldMimeType, | 135 kRemotingViewerPluginOldMimeType, |
136 std::string(), | 136 std::string(), |
137 std::string()); | 137 std::string()); |
138 info.mime_types.push_back(old_remoting_mime_type); | 138 info.mime_types.push_back(old_remoting_mime_type); |
139 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; | 139 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; |
140 info.internal_entry_points.initialize_module = | 140 info.internal_entry_points.initialize_module = |
141 remoting::PPP_InitializeModule; | 141 remoting::PPP_InitializeModule; |
142 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; | 142 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; |
143 | 143 |
144 plugins->push_back(info); | 144 plugins->push_back(info); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 if (flash_version_numbers.size() < 2) | 176 if (flash_version_numbers.size() < 2) |
177 flash_version_numbers.push_back("2"); | 177 flash_version_numbers.push_back("2"); |
178 if (flash_version_numbers.size() < 3) | 178 if (flash_version_numbers.size() < 3) |
179 flash_version_numbers.push_back("999"); | 179 flash_version_numbers.push_back("999"); |
180 if (flash_version_numbers.size() < 4) | 180 if (flash_version_numbers.size() < 4) |
181 flash_version_numbers.push_back("999"); | 181 flash_version_numbers.push_back("999"); |
182 // E.g., "Shockwave Flash 10.2 r154": | 182 // E.g., "Shockwave Flash 10.2 r154": |
183 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + | 183 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + |
184 flash_version_numbers[1] + " r" + flash_version_numbers[2]; | 184 flash_version_numbers[1] + " r" + flash_version_numbers[2]; |
185 plugin.version = JoinString(flash_version_numbers, '.'); | 185 plugin.version = JoinString(flash_version_numbers, '.'); |
186 webkit::npapi::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, | 186 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, |
187 kFlashPluginSwfExtension, | 187 kFlashPluginSwfExtension, |
188 kFlashPluginSwfDescription); | 188 kFlashPluginSwfDescription); |
189 plugin.mime_types.push_back(swf_mime_type); | 189 plugin.mime_types.push_back(swf_mime_type); |
190 webkit::npapi::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, | 190 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, |
191 kFlashPluginSplExtension, | 191 kFlashPluginSplExtension, |
192 kFlashPluginSplDescription); | 192 kFlashPluginSplDescription); |
193 plugin.mime_types.push_back(spl_mime_type); | 193 plugin.mime_types.push_back(spl_mime_type); |
194 plugins->push_back(plugin); | 194 plugins->push_back(plugin); |
195 } | 195 } |
196 | 196 |
197 #endif // !defined(NACL_WIN64) | 197 #endif // !defined(NACL_WIN64) |
198 | 198 |
199 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
200 // Launches the privileged flash broker, used when flash is sandboxed. | 200 // Launches the privileged flash broker, used when flash is sandboxed. |
201 // The broker is the same flash dll, except that it uses a different | 201 // The broker is the same flash dll, except that it uses a different |
202 // entrypoint (BrokerMain) and it is hosted in windows' generic surrogate | 202 // entrypoint (BrokerMain) and it is hosted in windows' generic surrogate |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 void ChromeContentClient::SetActiveURL(const GURL& url) { | 264 void ChromeContentClient::SetActiveURL(const GURL& url) { |
265 child_process_logging::SetActiveURL(url); | 265 child_process_logging::SetActiveURL(url); |
266 } | 266 } |
267 | 267 |
268 void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) { | 268 void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) { |
269 child_process_logging::SetGpuInfo(gpu_info); | 269 child_process_logging::SetGpuInfo(gpu_info); |
270 } | 270 } |
271 | 271 |
272 void ChromeContentClient::AddPepperPlugins( | 272 void ChromeContentClient::AddPepperPlugins( |
273 std::vector<PepperPluginInfo>* plugins) { | 273 std::vector<PepperPluginInfo>* plugins) { |
274 ::OutputDebugStringA("ChromeContentClient::AddPepperPlugins"); | |
Nico
2011/08/14 02:46:06
remove
| |
274 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. | 275 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. |
275 ComputeBuiltInPlugins(plugins); | 276 ComputeBuiltInPlugins(plugins); |
276 AddOutOfProcessFlash(plugins); | 277 AddOutOfProcessFlash(plugins); |
277 #endif | 278 #endif |
278 } | 279 } |
279 | 280 |
280 bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { | 281 bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { |
281 // Any Chrome-specific messages that must be allowed to be sent from swapped | 282 // Any Chrome-specific messages that must be allowed to be sent from swapped |
282 // out renderers. | 283 // out renderers. |
283 switch (msg->type()) { | 284 switch (msg->type()) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 383 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
383 policy->SetTokenLevel( | 384 policy->SetTokenLevel( |
384 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 385 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
385 } | 386 } |
386 | 387 |
387 return true; | 388 return true; |
388 } | 389 } |
389 #endif | 390 #endif |
390 | 391 |
391 } // namespace chrome | 392 } // namespace chrome |
OLD | NEW |