diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-10 05:56:56 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-10 05:56:56 +0000 |
commit | aa051274bdd5359b31fe250152a7db8ccf2879bf (patch) | |
tree | 8fbc6bde879e0d82bb602ce7b366bf86172719c8 /android_webview/common | |
parent | c53f6ac2da44db7f880f548f4ba393168d211e9c (diff) | |
download | chromium_src-aa051274bdd5359b31fe250152a7db8ccf2879bf.zip chromium_src-aa051274bdd5359b31fe250152a7db8ccf2879bf.tar.gz chromium_src-aa051274bdd5359b31fe250152a7db8ccf2879bf.tar.bz2 |
Simplify the user agent code some more since after r255534 it's not affected by the site's URL.
Code in content always gets it now from ContentClient::GetUserAgent. In Chrome, there's a GetUserAgent function which returns it.
BUG=338338
R=isherman@chromium.org, pauljensen@chromium.org, scottmg@chromium.org, tfarina@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=255858
Review URL: https://codereview.chromium.org/191093002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/common')
-rw-r--r-- | android_webview/common/aw_content_client.cc | 18 | ||||
-rw-r--r-- | android_webview/common/aw_content_client.h | 2 |
2 files changed, 17 insertions, 3 deletions
diff --git a/android_webview/common/aw_content_client.cc b/android_webview/common/aw_content_client.cc index e91faa9..856e7b7 100644 --- a/android_webview/common/aw_content_client.cc +++ b/android_webview/common/aw_content_client.cc @@ -12,16 +12,20 @@ #include "ui/base/resource/resource_bundle.h" #include "webkit/common/user_agent/user_agent_util.h" -namespace android_webview { +namespace { -std::string AwContentClient::GetProduct() const { +std::string GetProduct() { // "Chrome/XX.0.0.0" identifies that this WebView is derived from the // corresponding Chromium version XX. // TODO(torne): Use chrome/VERSION file. See http://crbug.com/297522 return "Chrome/33.0.0.0"; } -std::string AwContentClient::GetUserAgent() const { +} + +namespace android_webview { + +std::string GetUserAgent() { // "Version/4.0" had been hardcoded in the legacy WebView. std::string product = "Version/4.0 " + GetProduct(); if (CommandLine::ForCurrentProcess()->HasSwitch( @@ -31,6 +35,14 @@ std::string AwContentClient::GetUserAgent() const { return webkit_glue::BuildUserAgentFromProduct(product); } +std::string AwContentClient::GetProduct() const { + return ::GetProduct(); +} + +std::string AwContentClient::GetUserAgent() const { + return android_webview::GetUserAgent(); +} + base::string16 AwContentClient::GetLocalizedString(int message_id) const { // TODO(boliu): Used only by WebKit, so only bundle those resources for // Android WebView. diff --git a/android_webview/common/aw_content_client.h b/android_webview/common/aw_content_client.h index b764944..697f4e3 100644 --- a/android_webview/common/aw_content_client.h +++ b/android_webview/common/aw_content_client.h @@ -11,6 +11,8 @@ namespace android_webview { +std::string GetUserAgent(); + class AwContentClient : public content::ContentClient { public: // ContentClient implementation. |