Bug 861164 - use different search URLs for tablet vs. non-tablet r=gavin

This commit is contained in:
Mark Finkle 2013-06-05 22:29:40 -04:00
parent 56bffabc42
commit 2189596918

View File

@ -2504,10 +2504,35 @@ Engine.prototype = {
this._lazySerializeToFile();
},
#ifdef ANDROID
get _defaultMobileResponseType() {
let type = URLTYPE_SEARCH_HTML;
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
let isTablet = sysInfo.get("tablet");
if (isTablet && this.supportsResponseType("application/x-moz-tabletsearch")) {
// Check for a tablet-specific search URL override
type = "application/x-moz-tabletsearch";
} else if (!isTablet && this.supportsResponseType("application/x-moz-phonesearch")) {
// Check for a phone-specific search URL override
type = "application/x-moz-phonesearch";
}
delete this._defaultMobileResponseType;
return this._defaultMobileResponseType = type;
},
#endif
// from nsISearchEngine
getSubmission: function SRCH_ENG_getSubmission(aData, aResponseType, aPurpose) {
if (!aResponseType)
#ifdef ANDROID
if (!aResponseType) {
aResponseType = this._defaultMobileResponseType;
}
#endif
if (!aResponseType) {
aResponseType = URLTYPE_SEARCH_HTML;
}
var url = this._getURLOfType(aResponseType);