mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 01:59:29 +00:00
Bug 671634 - Fennec UA changes. Useragent should be different between phones and tablets. r=me sr=bz a=gerv
Please read http://groups.google.com/group/mozilla.dev.platform/msg/8133920a2ccf4d5b for the details. Also see https://wiki.mozilla.org/Fennec/User_Agent for Gerv's accepted proposal.
This commit is contained in:
parent
04c5eea3f9
commit
bc2e11a2c4
@ -57,7 +57,6 @@ pref("toolkit.browser.cacheRatioHeight", 3000);
|
||||
pref("toolkit.browser.contentViewExpire", 3000);
|
||||
|
||||
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
|
||||
pref("general.useragent.compatMode.firefox", true);
|
||||
pref("browser.chromeURL", "chrome://browser/content/");
|
||||
|
||||
pref("browser.tabs.warnOnClose", true);
|
||||
|
@ -39,6 +39,7 @@ MOZ_APP_BASENAME=Fennec
|
||||
MOZ_APP_VENDOR=Mozilla
|
||||
|
||||
MOZ_APP_VERSION=13.0a1
|
||||
MOZ_APP_UA_NAME=Firefox
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial
|
||||
MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/android/branding/official
|
||||
|
@ -307,7 +307,11 @@ nsHttpHandler::Init()
|
||||
rv = InitConnectionMgr();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef ANDROID
|
||||
mProductSub.AssignLiteral(MOZ_APP_UA_VERSION);
|
||||
#else
|
||||
mProductSub.AssignLiteral(MOZ_UA_BUILDID);
|
||||
#endif
|
||||
if (mProductSub.IsEmpty() && appInfo)
|
||||
appInfo->GetPlatformBuildID(mProductSub);
|
||||
if (mProductSub.Length() > 8)
|
||||
@ -602,6 +606,7 @@ nsHttpHandler::BuildUserAgent()
|
||||
mAppName.Length() +
|
||||
mAppVersion.Length() +
|
||||
mCompatFirefox.Length() +
|
||||
mCompatDevice.Length() +
|
||||
13);
|
||||
|
||||
// Application portion
|
||||
@ -616,8 +621,15 @@ nsHttpHandler::BuildUserAgent()
|
||||
mUserAgent += mPlatform;
|
||||
mUserAgent.AppendLiteral("; ");
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
if (!mCompatDevice.IsEmpty()) {
|
||||
mUserAgent += mCompatDevice;
|
||||
mUserAgent.AppendLiteral("; ");
|
||||
}
|
||||
#else
|
||||
mUserAgent += mOscpu;
|
||||
mUserAgent.AppendLiteral("; ");
|
||||
#endif
|
||||
mUserAgent += mMisc;
|
||||
mUserAgent += ')';
|
||||
|
||||
@ -650,8 +662,7 @@ typedef BOOL (WINAPI *IsWow64ProcessP) (HANDLE, PBOOL);
|
||||
void
|
||||
nsHttpHandler::InitUserAgentComponents()
|
||||
{
|
||||
|
||||
// Gather platform.
|
||||
// Gather platform.
|
||||
mPlatform.AssignLiteral(
|
||||
#if defined(ANDROID)
|
||||
"Android"
|
||||
@ -670,6 +681,18 @@ nsHttpHandler::InitUserAgentComponents()
|
||||
#endif
|
||||
);
|
||||
|
||||
#if defined(ANDROID)
|
||||
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
|
||||
NS_ASSERTION(infoService, "Could not find a system info service");
|
||||
|
||||
bool isTablet;
|
||||
infoService->GetPropertyAsBool(NS_LITERAL_STRING("tablet"), &isTablet);
|
||||
if (isTablet)
|
||||
mCompatDevice.AssignLiteral("Tablet");
|
||||
else
|
||||
mCompatDevice.AssignLiteral("Mobile");
|
||||
#endif
|
||||
|
||||
// Gather OS/CPU.
|
||||
#if defined(XP_OS2)
|
||||
ULONG os2ver = 0;
|
||||
|
@ -321,6 +321,7 @@ private:
|
||||
nsXPIDLCString mAppName;
|
||||
nsXPIDLCString mAppVersion;
|
||||
nsCString mCompatFirefox;
|
||||
nsXPIDLCString mCompatDevice;
|
||||
|
||||
nsCString mUserAgent;
|
||||
nsXPIDLCString mUserAgentOverride;
|
||||
|
@ -201,7 +201,7 @@ nsSystemInfo::Init()
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("shellVersion"), str);
|
||||
}
|
||||
bool isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
|
||||
SetPropertyAsBool(NS_LITERAL_STRING("isTablet"), isTablet);
|
||||
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), isTablet);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user