| 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" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.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/win/windows_version.h" | 15 #include "base/win/windows_version.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/render_messages.h" | |
| 21 #include "content/common/pepper_plugin_registry.h" | 20 #include "content/common/pepper_plugin_registry.h" |
| 22 #include "remoting/client/plugin/pepper_entrypoints.h" | 21 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "webkit/glue/user_agent.h" |
| 25 | 25 |
| 26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 27 #include "content/common/sandbox_policy.h" | 27 #include "content/common/sandbox_policy.h" |
| 28 #include "sandbox/src/sandbox.h" | 28 #include "sandbox/src/sandbox.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #include "webkit/glue/user_agent.h" | 31 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. |
| 32 #include "chrome/common/render_messages.h" |
| 33 #endif |
| 32 | 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 const char* kPDFPluginName = "Chrome PDF Viewer"; | 37 const char* kPDFPluginName = "Chrome PDF Viewer"; |
| 36 const char* kPDFPluginMimeType = "application/pdf"; | 38 const char* kPDFPluginMimeType = "application/pdf"; |
| 37 const char* kPDFPluginExtension = "pdf"; | 39 const char* kPDFPluginExtension = "pdf"; |
| 38 const char* kPDFPluginDescription = "Portable Document Format"; | 40 const char* kPDFPluginDescription = "Portable Document Format"; |
| 39 const char* kPDFPluginPrintPreviewMimeType | 41 const char* kPDFPluginPrintPreviewMimeType |
| 40 = "application/x-google-chrome-print-preview-pdf"; | 42 = "application/x-google-chrome-print-preview-pdf"; |
| 41 | 43 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 283 |
| 282 void ChromeContentClient::AddPepperPlugins( | 284 void ChromeContentClient::AddPepperPlugins( |
| 283 std::vector<PepperPluginInfo>* plugins) { | 285 std::vector<PepperPluginInfo>* plugins) { |
| 284 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. | 286 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. |
| 285 ComputeBuiltInPlugins(plugins); | 287 ComputeBuiltInPlugins(plugins); |
| 286 AddOutOfProcessFlash(plugins); | 288 AddOutOfProcessFlash(plugins); |
| 287 #endif | 289 #endif |
| 288 } | 290 } |
| 289 | 291 |
| 290 bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { | 292 bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { |
| 293 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. |
| 291 // Any Chrome-specific messages that must be allowed to be sent from swapped | 294 // Any Chrome-specific messages that must be allowed to be sent from swapped |
| 292 // out renderers. | 295 // out renderers. |
| 293 switch (msg->type()) { | 296 switch (msg->type()) { |
| 294 case ChromeViewHostMsg_DomOperationResponse::ID: | 297 case ChromeViewHostMsg_DomOperationResponse::ID: |
| 295 return true; | 298 return true; |
| 296 default: | 299 default: |
| 297 break; | 300 break; |
| 298 } | 301 } |
| 302 #endif |
| 299 return false; | 303 return false; |
| 300 } | 304 } |
| 301 | 305 |
| 302 bool ChromeContentClient::CanHandleWhileSwappedOut( | 306 bool ChromeContentClient::CanHandleWhileSwappedOut( |
| 303 const IPC::Message& msg) { | 307 const IPC::Message& msg) { |
| 308 #if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. |
| 304 // Any Chrome-specific messages (apart from those listed in | 309 // Any Chrome-specific messages (apart from those listed in |
| 305 // CanSendWhileSwappedOut) that must be handled by the browser when sent from | 310 // CanSendWhileSwappedOut) that must be handled by the browser when sent from |
| 306 // swapped out renderers. | 311 // swapped out renderers. |
| 307 switch (msg.type()) { | 312 switch (msg.type()) { |
| 308 case ChromeViewHostMsg_Snapshot::ID: | 313 case ChromeViewHostMsg_Snapshot::ID: |
| 309 return true; | 314 return true; |
| 310 default: | 315 default: |
| 311 break; | 316 break; |
| 312 } | 317 } |
| 318 #endif |
| 313 return false; | 319 return false; |
| 314 } | 320 } |
| 315 | 321 |
| 316 std::string ChromeContentClient::GetUserAgent(bool mimic_windows) const { | 322 std::string ChromeContentClient::GetUserAgent(bool mimic_windows) const { |
| 317 chrome::VersionInfo version_info; | 323 chrome::VersionInfo version_info; |
| 318 std::string product("Chrome/"); | 324 std::string product("Chrome/"); |
| 319 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | 325 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; |
| 320 | 326 |
| 321 return webkit_glue::BuildUserAgentHelper(mimic_windows, product); | 327 return webkit_glue::BuildUserAgentHelper(mimic_windows, product); |
| 322 } | 328 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 397 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
| 392 policy->SetTokenLevel( | 398 policy->SetTokenLevel( |
| 393 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 399 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
| 394 } | 400 } |
| 395 | 401 |
| 396 return true; | 402 return true; |
| 397 } | 403 } |
| 398 #endif | 404 #endif |
| 399 | 405 |
| 400 } // namespace chrome | 406 } // namespace chrome |
| OLD | NEW |