diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 18:30:34 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 18:30:34 +0000 |
commit | 79bd6e8691a7ff0b1d2b66a54cd09c9b874da8f9 (patch) | |
tree | 2c8c644bbe31800f3053156f73fb44cb3ef7a291 /chrome_frame | |
parent | 0b91391a2054c836e6710eb19d00342164791a0f (diff) | |
download | chromium_src-79bd6e8691a7ff0b1d2b66a54cd09c9b874da8f9.zip chromium_src-79bd6e8691a7ff0b1d2b66a54cd09c9b874da8f9.tar.gz chromium_src-79bd6e8691a7ff0b1d2b66a54cd09c9b874da8f9.tar.bz2 |
Re-land r102336 (remove webkit_glue::BuildUserAgent) w/ fix.
Remove webkit_glue::BuildUserAgent(), change the contract in webkit_glue so
that SetUserAgent() must be called before GetUserAgent().
This was causing a dependency inversion between webkit_support and its clients,
and was needed for the content component build.
For content users, calling SetContentClient() will automatically initialize the
user agent (retrieved from client->GetUserAgent()).
As a bonus, fixing this allowed me to re-test the "mimic_windows" code path and
it looks like we no longer need it.
R=jam@chromium.org,rsesek@chromium.org
BUG=11136, 90442
TEST=visit yahoo! mail using Chromium on Linux, ensure that we don't get an "unsupported browser" warning.
Review URL: http://codereview.chromium.org/8045005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/html_utils.cc | 4 | ||||
-rw-r--r-- | chrome_frame/renderer_glue.cc | 14 | ||||
-rw-r--r-- | chrome_frame/test/html_util_unittests.cc | 15 |
3 files changed, 13 insertions, 20 deletions
diff --git a/chrome_frame/html_utils.cc b/chrome_frame/html_utils.cc index 9458166..3121a75 100644 --- a/chrome_frame/html_utils.cc +++ b/chrome_frame/html_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -385,7 +385,7 @@ const char* GetChromeUserAgent() { product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; - ua = webkit_glue::BuildUserAgentHelper(false, product); + ua = webkit_glue::BuildUserAgentFromProduct(product); DCHECK(ua.length() < arraysize(g_chrome_user_agent)); lstrcpynA(g_chrome_user_agent, ua.c_str(), diff --git a/chrome_frame/renderer_glue.cc b/chrome_frame/renderer_glue.cc index d904506..96ccdc1 100644 --- a/chrome_frame/renderer_glue.cc +++ b/chrome_frame/renderer_glue.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,15 +12,3 @@ class GURL; bool IsPluginProcess() { return false; } - -namespace webkit_glue { - -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 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 9d59106..17589c0 100644 --- a/chrome_frame/test/html_util_unittests.cc +++ b/chrome_frame/test/html_util_unittests.cc @@ -20,11 +20,12 @@ #include "net/base/net_util.h" #include "chrome/browser/automation/url_request_automation_job.h" +#include "chrome/common/chrome_version_info.h" #include "chrome_frame/chrome_frame_automation.h" #include "chrome_frame/chrome_frame_delegate.h" #include "chrome_frame/html_utils.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/glue/webkit_glue.h" +#include "webkit/glue/user_agent.h" const char kChromeFrameUserAgent[] = "chromeframe"; @@ -403,11 +404,15 @@ TEST_F(HtmlUtilUnittest, GetDefaultUserAgentHeaderWithCFTag) { } TEST_F(HtmlUtilUnittest, GetChromeUserAgent) { - std::string chrome_ua; - chrome_ua = webkit_glue::BuildUserAgent(false); - EXPECT_FALSE(chrome_ua.empty()); + // This code is duplicated from chrome_content_client.cc to avoid + // introducing a link-time dependency on chrome_common. + chrome::VersionInfo version_info; + std::string product("Chrome/"); + product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; + std::string chrome_ua(webkit_glue::BuildUserAgentFromProduct(product)); + const char* ua = http_utils::GetChromeUserAgent(); - EXPECT_EQ(0, chrome_ua.compare(ua)); + EXPECT_EQ(ua, chrome_ua); } TEST_F(HtmlUtilUnittest, GetDefaultUserAgent) { |