| 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/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/pepper_flash.h" | 21 #include "chrome/common/pepper_flash.h" |
| 22 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "components/nacl/common/nacl_process_type.h" | 24 #include "components/nacl/common/nacl_process_type.h" |
| 25 #include "content/public/common/content_constants.h" |
| 25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/pepper_plugin_info.h" | 27 #include "content/public/common/pepper_plugin_info.h" |
| 27 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
| 28 #include "extensions/common/constants.h" | 29 #include "extensions/common/constants.h" |
| 29 #include "grit/common_resources.h" | 30 #include "grit/common_resources.h" |
| 30 #include "ppapi/shared_impl/ppapi_permissions.h" | 31 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 31 #include "remoting/client/plugin/pepper_entrypoints.h" | 32 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/base/layout.h" | 34 #include "ui/base/layout.h" |
| 34 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 35 #include "webkit/common/user_agent/user_agent_util.h" | 36 #include "webkit/common/user_agent/user_agent_util.h" |
| 36 #include "webkit/plugins/plugin_constants.h" | |
| 37 #include "webkit/plugins/plugin_switches.h" | |
| 38 | 37 |
| 39 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 38 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 40 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 39 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 41 | 40 |
| 42 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 43 #include "base/win/registry.h" | 42 #include "base/win/registry.h" |
| 44 #include "base/win/windows_version.h" | 43 #include "base/win/windows_version.h" |
| 45 #include "sandbox/win/src/sandbox.h" | 44 #include "sandbox/win/src/sandbox.h" |
| 46 #elif defined(OS_MACOSX) | 45 #elif defined(OS_MACOSX) |
| 47 #include "components/nacl/common/nacl_sandbox_type_mac.h" | 46 #include "components/nacl/common/nacl_sandbox_type_mac.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 292 } |
| 294 | 293 |
| 295 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, | 294 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, |
| 296 const std::string& version) { | 295 const std::string& version) { |
| 297 content::PepperPluginInfo plugin; | 296 content::PepperPluginInfo plugin; |
| 298 | 297 |
| 299 // Flash being out of process is handled separately than general plugins | 298 // Flash being out of process is handled separately than general plugins |
| 300 // for testing purposes. | 299 // for testing purposes. |
| 301 plugin.is_out_of_process = !CommandLine::ForCurrentProcess()->HasSwitch( | 300 plugin.is_out_of_process = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 302 switches::kPpapiFlashInProcess); | 301 switches::kPpapiFlashInProcess); |
| 303 plugin.name = kFlashPluginName; | 302 plugin.name = content::kFlashPluginName; |
| 304 plugin.path = path; | 303 plugin.path = path; |
| 305 plugin.permissions = kPepperFlashPermissions; | 304 plugin.permissions = kPepperFlashPermissions; |
| 306 | 305 |
| 307 std::vector<std::string> flash_version_numbers; | 306 std::vector<std::string> flash_version_numbers; |
| 308 base::SplitString(version, '.', &flash_version_numbers); | 307 base::SplitString(version, '.', &flash_version_numbers); |
| 309 if (flash_version_numbers.size() < 1) | 308 if (flash_version_numbers.size() < 1) |
| 310 flash_version_numbers.push_back("11"); | 309 flash_version_numbers.push_back("11"); |
| 311 // |SplitString()| puts in an empty string given an empty string. :( | 310 // |SplitString()| puts in an empty string given an empty string. :( |
| 312 else if (flash_version_numbers[0].empty()) | 311 else if (flash_version_numbers[0].empty()) |
| 313 flash_version_numbers[0] = "11"; | 312 flash_version_numbers[0] = "11"; |
| 314 if (flash_version_numbers.size() < 2) | 313 if (flash_version_numbers.size() < 2) |
| 315 flash_version_numbers.push_back("2"); | 314 flash_version_numbers.push_back("2"); |
| 316 if (flash_version_numbers.size() < 3) | 315 if (flash_version_numbers.size() < 3) |
| 317 flash_version_numbers.push_back("999"); | 316 flash_version_numbers.push_back("999"); |
| 318 if (flash_version_numbers.size() < 4) | 317 if (flash_version_numbers.size() < 4) |
| 319 flash_version_numbers.push_back("999"); | 318 flash_version_numbers.push_back("999"); |
| 320 // E.g., "Shockwave Flash 10.2 r154": | 319 // E.g., "Shockwave Flash 10.2 r154": |
| 321 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + | 320 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + |
| 322 flash_version_numbers[1] + " r" + flash_version_numbers[2]; | 321 flash_version_numbers[1] + " r" + flash_version_numbers[2]; |
| 323 plugin.version = JoinString(flash_version_numbers, '.'); | 322 plugin.version = JoinString(flash_version_numbers, '.'); |
| 324 content::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, | 323 content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType, |
| 325 kFlashPluginSwfExtension, | 324 content::kFlashPluginSwfExtension, |
| 326 kFlashPluginSwfDescription); | 325 content::kFlashPluginSwfDescription); |
| 327 plugin.mime_types.push_back(swf_mime_type); | 326 plugin.mime_types.push_back(swf_mime_type); |
| 328 content::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, | 327 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, |
| 329 kFlashPluginSplExtension, | 328 content::kFlashPluginSplExtension, |
| 330 kFlashPluginSplDescription); | 329 content::kFlashPluginSplDescription); |
| 331 plugin.mime_types.push_back(spl_mime_type); | 330 plugin.mime_types.push_back(spl_mime_type); |
| 332 | 331 |
| 333 return plugin; | 332 return plugin; |
| 334 } | 333 } |
| 335 | 334 |
| 336 void AddPepperFlashFromCommandLine( | 335 void AddPepperFlashFromCommandLine( |
| 337 std::vector<content::PepperPluginInfo>* plugins) { | 336 std::vector<content::PepperPluginInfo>* plugins) { |
| 338 const CommandLine::StringType flash_path = | 337 const CommandLine::StringType flash_path = |
| 339 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 338 CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 340 switches::kPpapiFlashPath); | 339 switches::kPpapiFlashPath); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 484 } |
| 486 return false; | 485 return false; |
| 487 } | 486 } |
| 488 | 487 |
| 489 std::string ChromeContentClient::GetCarbonInterposePath() const { | 488 std::string ChromeContentClient::GetCarbonInterposePath() const { |
| 490 return std::string(kInterposeLibraryPath); | 489 return std::string(kInterposeLibraryPath); |
| 491 } | 490 } |
| 492 #endif | 491 #endif |
| 493 | 492 |
| 494 } // namespace chrome | 493 } // namespace chrome |
| OLD | NEW |