diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 19:30:31 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 19:30:31 +0000 |
commit | b0d9bfae8b254a3c4bff72fbba934271e2191dde (patch) | |
tree | d6ea0cd46e2e866f37f6c261ffd938b03421f2f1 /chrome_frame/html_utils.cc | |
parent | 00509dbbd9762b409c94f07860bd20dad7063fa0 (diff) | |
download | chromium_src-b0d9bfae8b254a3c4bff72fbba934271e2191dde.zip chromium_src-b0d9bfae8b254a3c4bff72fbba934271e2191dde.tar.gz chromium_src-b0d9bfae8b254a3c4bff72fbba934271e2191dde.tar.bz2 |
Have a consistent UA string with chromeframe token
When using 'PostPlatform' registry, chromeframe UA token
appears in the middle whereas when we dynamically append
the UA we place it at the end. This has caused issues with
sites looking for it in a specific place.
This change modifies the logic while dynamically appending
the UA to insert it consistently in the place where
PostPlatform puts it.
BUG=70024
TEST=covered by HtmlUtilUnittest.AddChromeFrameToUserAgentValue
Review URL: http://codereview.chromium.org/6246088
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/html_utils.cc')
-rw-r--r-- | chrome_frame/html_utils.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome_frame/html_utils.cc b/chrome_frame/html_utils.cc index 1d4d629..25e4829 100644 --- a/chrome_frame/html_utils.cc +++ b/chrome_frame/html_utils.cc @@ -354,8 +354,16 @@ std::string AddChromeFrameToUserAgentValue(const std::string& value) { } std::string ret(value); - ret += " "; - ret += GetChromeFrameUserAgent(); + std::string::size_type insert_position = ret.find(')'); + if (insert_position != std::string::npos) { + if (insert_position > 1 && isalnum(ret[insert_position - 1])) + ret.insert(insert_position++, ";"); + ret.insert(insert_position++, " "); + ret.insert(insert_position, GetChromeFrameUserAgent()); + } else { + ret += " "; + ret += GetChromeFrameUserAgent(); + } return ret; } |