summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 22:35:50 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 22:35:50 +0000
commitd7196e3474c92f1e85c32f98ad564a32604fa535 (patch)
treeac137140b97ff1af774775e80e0708c15fa28f6a /chrome_frame
parenta65ed542245bbe6089590d06507892a704fb08f0 (diff)
downloadchromium_src-d7196e3474c92f1e85c32f98ad564a32604fa535.zip
chromium_src-d7196e3474c92f1e85c32f98ad564a32604fa535.tar.gz
chromium_src-d7196e3474c92f1e85c32f98ad564a32604fa535.tar.bz2
Removed the GetProductVersion function from webkit_glue and replace it with the BuildUserAgent function.
The BuildUserAgent function has been deleted from user_agent.cc. The implementation of this function in content\renderer_glue.cc calls the GetUserAgent API in ContentClient which is implemented by the embedder (Chrome). Added implementations of the BuildUserAgent function for test_shell and DumpRenderTree. To build the user agent string we need the webkit major and minor versions. Added getters for them in the webkit_glue namespace in the user_agent.h/.cc files. This helps reduce the implicit dependency of content on chrome. BUG=82454 Review URL: http://codereview.chromium.org/7166004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/html_utils.cc10
-rw-r--r--chrome_frame/renderer_glue.cc14
-rw-r--r--chrome_frame/test/html_util_unittests.cc4
3 files changed, 16 insertions, 12 deletions
diff --git a/chrome_frame/html_utils.cc b/chrome_frame/html_utils.cc
index 25e4829..9458166 100644
--- a/chrome_frame/html_utils.cc
+++ b/chrome_frame/html_utils.cc
@@ -10,6 +10,7 @@
#include "base/string_util.h"
#include "base/string_tokenizer.h"
#include "base/stringprintf.h"
+#include "chrome/common/chrome_version_info.h"
#include "chrome_frame/utils.h"
#include "net/base/net_util.h"
#include "webkit/glue/user_agent.h"
@@ -378,7 +379,14 @@ const char* GetChromeUserAgent() {
_pAtlModule->m_csStaticDataInitAndTypeInfo.Lock();
if (!g_chrome_user_agent[0]) {
std::string ua;
- webkit_glue::BuildUserAgent(false, &ua);
+
+ chrome::VersionInfo version_info;
+ std::string product("Chrome/");
+ product += version_info.is_valid() ? version_info.Version()
+ : "0.0.0.0";
+
+ ua = webkit_glue::BuildUserAgentHelper(false, product);
+
DCHECK(ua.length() < arraysize(g_chrome_user_agent));
lstrcpynA(g_chrome_user_agent, ua.c_str(),
arraysize(g_chrome_user_agent) - 1);
diff --git a/chrome_frame/renderer_glue.cc b/chrome_frame/renderer_glue.cc
index 6f4b7fe..64890ef 100644
--- a/chrome_frame/renderer_glue.cc
+++ b/chrome_frame/renderer_glue.cc
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "webkit/glue/user_agent.h"
+#include "webkit/glue/webkit_glue.h"
+
#include "chrome/common/chrome_version_info.h"
class GURL;
@@ -12,23 +15,16 @@ bool IsPluginProcess() {
namespace webkit_glue {
-bool IsDefaultPluginEnabled() {
- return false;
-}
-
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
return false;
}
-// This function is called from BuildUserAgent so we have our own version
-// here instead of pulling in the whole renderer lib where this function
-// is implemented for Chrome.
-std::string GetProductVersion() {
+std::string BuildUserAgent(bool mimic_windows) {
chrome::VersionInfo version_info;
std::string product("Chrome/");
product += version_info.is_valid() ? version_info.Version()
: "0.0.0.0";
- return product;
+ return webkit_glue::BuildUserAgentHelper(mimic_windows, product);
}
} // end namespace webkit_glue
diff --git a/chrome_frame/test/html_util_unittests.cc b/chrome_frame/test/html_util_unittests.cc
index eb7d386..9d59106 100644
--- a/chrome_frame/test/html_util_unittests.cc
+++ b/chrome_frame/test/html_util_unittests.cc
@@ -24,7 +24,7 @@
#include "chrome_frame/chrome_frame_delegate.h"
#include "chrome_frame/html_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/glue/user_agent.h"
+#include "webkit/glue/webkit_glue.h"
const char kChromeFrameUserAgent[] = "chromeframe";
@@ -404,7 +404,7 @@ TEST_F(HtmlUtilUnittest, GetDefaultUserAgentHeaderWithCFTag) {
TEST_F(HtmlUtilUnittest, GetChromeUserAgent) {
std::string chrome_ua;
- webkit_glue::BuildUserAgent(false, &chrome_ua);
+ chrome_ua = webkit_glue::BuildUserAgent(false);
EXPECT_FALSE(chrome_ua.empty());
const char* ua = http_utils::GetChromeUserAgent();
EXPECT_EQ(0, chrome_ua.compare(ua));