| 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/stringprintf.h" | |
| 13 #include "base/string_split.h" | 12 #include "base/string_split.h" |
| 14 #include "base/string_util.h" | 13 #include "base/string_util.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/pepper_plugin_info.h" | 23 #include "content/public/common/pepper_plugin_info.h" |
| 24 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
| 25 #include "grit/common_resources.h" | 25 #include "grit/common_resources.h" |
| 26 #include "remoting/client/plugin/pepper_entrypoints.h" | 26 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/layout.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "webkit/glue/user_agent.h" | 30 #include "webkit/glue/user_agent.h" |
| 30 #include "webkit/plugins/npapi/plugin_list.h" | 31 #include "webkit/plugins/npapi/plugin_list.h" |
| 31 #include "webkit/plugins/plugin_constants.h" | 32 #include "webkit/plugins/plugin_constants.h" |
| 32 | 33 |
| 33 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 34 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 34 | 35 |
| 35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 36 #include "base/win/registry.h" | 37 #include "base/win/registry.h" |
| 37 #include "base/win/windows_version.h" | 38 #include "base/win/windows_version.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 chrome::VersionInfo version_info; | 411 chrome::VersionInfo version_info; |
| 411 std::string product("Chrome/"); | 412 std::string product("Chrome/"); |
| 412 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | 413 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; |
| 413 return webkit_glue::BuildUserAgentFromProduct(product); | 414 return webkit_glue::BuildUserAgentFromProduct(product); |
| 414 } | 415 } |
| 415 | 416 |
| 416 string16 ChromeContentClient::GetLocalizedString(int message_id) const { | 417 string16 ChromeContentClient::GetLocalizedString(int message_id) const { |
| 417 return l10n_util::GetStringUTF16(message_id); | 418 return l10n_util::GetStringUTF16(message_id); |
| 418 } | 419 } |
| 419 | 420 |
| 420 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { | 421 base::StringPiece ChromeContentClient::GetDataResource( |
| 421 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | |
| 422 } | |
| 423 | |
| 424 base::StringPiece ChromeContentClient::GetImageResource( | |
| 425 int resource_id, | 422 int resource_id, |
| 426 float scale_factor) const { | 423 ui::ScaleFactor scale_factor) const { |
| 427 // TODO(flackr): Pass scale_factor to ResourceBundle to get best matching | 424 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 428 // image resource for the given scale factor. | 425 resource_id, scale_factor); |
| 429 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | |
| 430 } | 426 } |
| 431 | 427 |
| 432 #if defined(OS_WIN) | 428 #if defined(OS_WIN) |
| 433 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line, | 429 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line, |
| 434 sandbox::TargetPolicy* policy) { | 430 sandbox::TargetPolicy* policy) { |
| 435 std::wstring plugin_dll = command_line-> | 431 std::wstring plugin_dll = command_line-> |
| 436 GetSwitchValueNative(switches::kPluginPath); | 432 GetSwitchValueNative(switches::kPluginPath); |
| 437 | 433 |
| 438 FilePath builtin_flash; | 434 FilePath builtin_flash; |
| 439 if (!PathService::Get(chrome::FILE_FLASH_PLUGIN, &builtin_flash)) | 435 if (!PathService::Get(chrome::FILE_FLASH_PLUGIN, &builtin_flash)) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 504 |
| 509 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( | 505 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( |
| 510 content::PepperPluginInfo* plugin, | 506 content::PepperPluginInfo* plugin, |
| 511 bool* override_npapi_flash) { | 507 bool* override_npapi_flash) { |
| 512 if (!ConductingPepperFlashFieldTrial()) | 508 if (!ConductingPepperFlashFieldTrial()) |
| 513 return false; | 509 return false; |
| 514 return GetBundledPepperFlash(plugin, override_npapi_flash); | 510 return GetBundledPepperFlash(plugin, override_npapi_flash); |
| 515 } | 511 } |
| 516 | 512 |
| 517 } // namespace chrome | 513 } // namespace chrome |
| OLD | NEW |