Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / common / chrome_content_client.cc
index e1f032a..26e24ce 100644 (file)
@@ -29,6 +29,7 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/common/pepper_plugin_info.h"
 #include "content/public/common/url_constants.h"
+#include "content/public/common/user_agent.h"
 #include "extensions/common/constants.h"
 #include "gpu/config/gpu_info.h"
 #include "grit/common_resources.h"
@@ -36,7 +37,6 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/layout.h"
 #include "ui/base/resource/resource_bundle.h"
-#include "webkit/common/user_agent/user_agent_util.h"
 
 #include "flapper_version.h"  // In SHARED_INTERMEDIATE_DIR.
 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR.
@@ -279,6 +279,8 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
       std::vector<std::string> codecs;
       codecs.push_back(kCdmSupportedCodecVorbis);
       codecs.push_back(kCdmSupportedCodecVp8);
+      // TODO(xhwang): Add VP9 when it's supported by Widevine CDM.
+      // See http://crbug.com/361318
 #if defined(USE_PROPRIETARY_CODECS)
 // TODO(ddorwin): Rename these macros to reflect their real meaning: whether the
 // CDM Chrome was built [and shipped] with support these types.
@@ -334,10 +336,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
                                                 const std::string& version) {
   content::PepperPluginInfo plugin;
 
-  // Flash being out of process is handled separately than general plugins
-  // for testing purposes.
-  plugin.is_out_of_process = !CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kPpapiFlashInProcess);
+  plugin.is_out_of_process = true;
   plugin.name = content::kFlashPluginName;
   plugin.path = path;
   plugin.permissions = kPepperFlashPermissions;
@@ -420,8 +419,27 @@ bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
 #endif  // FLAPPER_AVAILABLE
 }
 
+std::string GetProduct() {
+  chrome::VersionInfo version_info;
+  return version_info.is_valid() ?
+      version_info.ProductNameAndVersionForUserAgent() : std::string();
+}
+
 }  // namespace
 
+std::string GetUserAgent() {
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  if (command_line->HasSwitch(switches::kUserAgent))
+    return command_line->GetSwitchValueASCII(switches::kUserAgent);
+
+  std::string product = GetProduct();
+#if defined(OS_ANDROID)
+  if (command_line->HasSwitch(switches::kUseMobileUserAgent))
+    product += " Mobile";
+#endif
+  return content::BuildUserAgentFromProduct(product);
+}
+
 void ChromeContentClient::SetActiveURL(const GURL& url) {
   base::debug::SetCrashKeyValue(crash_keys::kActiveURL,
                                 url.possibly_invalid_spec());
@@ -463,6 +481,7 @@ void ChromeContentClient::AddAdditionalSchemes(
     std::vector<std::string>* savable_schemes) {
   standard_schemes->push_back(extensions::kExtensionScheme);
   savable_schemes->push_back(extensions::kExtensionScheme);
+  standard_schemes->push_back(chrome::kChromeNativeScheme);
   standard_schemes->push_back(extensions::kExtensionResourceScheme);
   savable_schemes->push_back(extensions::kExtensionResourceScheme);
   standard_schemes->push_back(chrome::kChromeSearchScheme);
@@ -474,28 +493,12 @@ void ChromeContentClient::AddAdditionalSchemes(
 #endif
 }
 
-bool ChromeContentClient::CanHandleWhileSwappedOut(
-    const IPC::Message& msg) {
-  // Any Chrome-specific messages (apart from those listed in
-  // CanSendWhileSwappedOut) that must be handled by the browser when sent from
-  // swapped out renderers.
-  return false;
-}
-
 std::string ChromeContentClient::GetProduct() const {
-  chrome::VersionInfo version_info;
-  return version_info.is_valid() ?
-      version_info.ProductNameAndVersionForUserAgent() : std::string();
+  return ::GetProduct();
 }
 
 std::string ChromeContentClient::GetUserAgent() const {
-  std::string product = GetProduct();
-#if defined(OS_ANDROID)
-  CommandLine* command_line = CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch(switches::kUseMobileUserAgent))
-    product += " Mobile";
-#endif
-  return webkit_glue::BuildUserAgentFromProduct(product);
+  return ::GetUserAgent();
 }
 
 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {