зеркало из https://github.com/mozilla/gecko-dev.git
Bug 863367 - Don't show urlbar for webapps loading app protocol pages. r=lucasr
This commit is contained in:
Родитель
53540c03eb
Коммит
8b87e22e42
|
@ -160,17 +160,30 @@ public class WebAppImpl extends GeckoApp {
|
|||
case SELECTED:
|
||||
case LOCATION_CHANGE:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
try {
|
||||
String title = tab.getURL();
|
||||
URL page = new URL(title);
|
||||
mTitlebarText.setText(page.getProtocol() + "://" + page.getHost());
|
||||
final String urlString = tab.getURL();
|
||||
final URL url;
|
||||
|
||||
if (mOrigin != null && mOrigin.getHost().equals(page.getHost()))
|
||||
mTitlebar.setVisibility(View.GONE);
|
||||
else
|
||||
mTitlebar.setVisibility(View.VISIBLE);
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
} catch (java.net.MalformedURLException ex) {
|
||||
Log.e(LOGTAG, "Unable to parse url: ", ex);
|
||||
mTitlebarText.setText(urlString);
|
||||
|
||||
// If we can't parse the url, and its an app protocol hide
|
||||
// the titlebar and return, otherwise show the titlebar
|
||||
// and the full url
|
||||
if (!urlString.startsWith("app://")) {
|
||||
mTitlebar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mTitlebar.setVisibility(View.GONE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (mOrigin != null && mOrigin.getHost().equals(url.getHost())) {
|
||||
mTitlebar.setVisibility(View.GONE);
|
||||
} else {
|
||||
mTitlebarText.setText(url.getProtocol() + "://" + url.getHost());
|
||||
mTitlebar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче