mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 861164 - use different search URLs for tablet vs. non-tablet r=gavin
This commit is contained in:
parent
003b496a3c
commit
d33ddcb2c2
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user