mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 18:31:08 +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.browser.contentViewExpire", 3000);
|
||||||
|
|
||||||
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
|
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
|
||||||
pref("general.useragent.compatMode.firefox", true);
|
|
||||||
pref("browser.chromeURL", "chrome://browser/content/");
|
pref("browser.chromeURL", "chrome://browser/content/");
|
||||||
|
|
||||||
pref("browser.tabs.warnOnClose", true);
|
pref("browser.tabs.warnOnClose", true);
|
||||||
|
@ -39,6 +39,7 @@ MOZ_APP_BASENAME=Fennec
|
|||||||
MOZ_APP_VENDOR=Mozilla
|
MOZ_APP_VENDOR=Mozilla
|
||||||
|
|
||||||
MOZ_APP_VERSION=13.0a1
|
MOZ_APP_VERSION=13.0a1
|
||||||
|
MOZ_APP_UA_NAME=Firefox
|
||||||
|
|
||||||
MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial
|
MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial
|
||||||
MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/android/branding/official
|
MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/android/branding/official
|
||||||
|
@ -307,7 +307,11 @@ nsHttpHandler::Init()
|
|||||||
rv = InitConnectionMgr();
|
rv = InitConnectionMgr();
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
mProductSub.AssignLiteral(MOZ_APP_UA_VERSION);
|
||||||
|
#else
|
||||||
mProductSub.AssignLiteral(MOZ_UA_BUILDID);
|
mProductSub.AssignLiteral(MOZ_UA_BUILDID);
|
||||||
|
#endif
|
||||||
if (mProductSub.IsEmpty() && appInfo)
|
if (mProductSub.IsEmpty() && appInfo)
|
||||||
appInfo->GetPlatformBuildID(mProductSub);
|
appInfo->GetPlatformBuildID(mProductSub);
|
||||||
if (mProductSub.Length() > 8)
|
if (mProductSub.Length() > 8)
|
||||||
@ -602,6 +606,7 @@ nsHttpHandler::BuildUserAgent()
|
|||||||
mAppName.Length() +
|
mAppName.Length() +
|
||||||
mAppVersion.Length() +
|
mAppVersion.Length() +
|
||||||
mCompatFirefox.Length() +
|
mCompatFirefox.Length() +
|
||||||
|
mCompatDevice.Length() +
|
||||||
13);
|
13);
|
||||||
|
|
||||||
// Application portion
|
// Application portion
|
||||||
@ -616,8 +621,15 @@ nsHttpHandler::BuildUserAgent()
|
|||||||
mUserAgent += mPlatform;
|
mUserAgent += mPlatform;
|
||||||
mUserAgent.AppendLiteral("; ");
|
mUserAgent.AppendLiteral("; ");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ANDROID
|
||||||
|
if (!mCompatDevice.IsEmpty()) {
|
||||||
|
mUserAgent += mCompatDevice;
|
||||||
|
mUserAgent.AppendLiteral("; ");
|
||||||
|
}
|
||||||
|
#else
|
||||||
mUserAgent += mOscpu;
|
mUserAgent += mOscpu;
|
||||||
mUserAgent.AppendLiteral("; ");
|
mUserAgent.AppendLiteral("; ");
|
||||||
|
#endif
|
||||||
mUserAgent += mMisc;
|
mUserAgent += mMisc;
|
||||||
mUserAgent += ')';
|
mUserAgent += ')';
|
||||||
|
|
||||||
@ -650,8 +662,7 @@ typedef BOOL (WINAPI *IsWow64ProcessP) (HANDLE, PBOOL);
|
|||||||
void
|
void
|
||||||
nsHttpHandler::InitUserAgentComponents()
|
nsHttpHandler::InitUserAgentComponents()
|
||||||
{
|
{
|
||||||
|
// Gather platform.
|
||||||
// Gather platform.
|
|
||||||
mPlatform.AssignLiteral(
|
mPlatform.AssignLiteral(
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
"Android"
|
"Android"
|
||||||
@ -670,6 +681,18 @@ nsHttpHandler::InitUserAgentComponents()
|
|||||||
#endif
|
#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.
|
// Gather OS/CPU.
|
||||||
#if defined(XP_OS2)
|
#if defined(XP_OS2)
|
||||||
ULONG os2ver = 0;
|
ULONG os2ver = 0;
|
||||||
|
@ -321,6 +321,7 @@ private:
|
|||||||
nsXPIDLCString mAppName;
|
nsXPIDLCString mAppName;
|
||||||
nsXPIDLCString mAppVersion;
|
nsXPIDLCString mAppVersion;
|
||||||
nsCString mCompatFirefox;
|
nsCString mCompatFirefox;
|
||||||
|
nsXPIDLCString mCompatDevice;
|
||||||
|
|
||||||
nsCString mUserAgent;
|
nsCString mUserAgent;
|
||||||
nsXPIDLCString mUserAgentOverride;
|
nsXPIDLCString mUserAgentOverride;
|
||||||
|
@ -201,7 +201,7 @@ nsSystemInfo::Init()
|
|||||||
SetPropertyAsAString(NS_LITERAL_STRING("shellVersion"), str);
|
SetPropertyAsAString(NS_LITERAL_STRING("shellVersion"), str);
|
||||||
}
|
}
|
||||||
bool isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
|
bool isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
|
||||||
SetPropertyAsBool(NS_LITERAL_STRING("isTablet"), isTablet);
|
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), isTablet);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user