Add support for "browser:" protocol
- Prevent browser:incognito from regular tab
The browser will now allow "browser:" protocol
based urls and treat "chrome:" protocol based urls
as a search query
Change-Id: I23098f160f4bd4e5f3c4ec431364388cf4e38790
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 36aae4c..a600fd3 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -234,7 +234,7 @@
PageState(Context c, boolean incognito) {
mIncognito = incognito;
if (mIncognito) {
- mOriginalUrl = mUrl = "chrome://incognito";
+ mOriginalUrl = mUrl = Controller.INCOGNITO_URI;
mTitle = c.getString(R.string.new_incognito_tab);
} else {
mOriginalUrl = mUrl = "";
@@ -607,7 +607,12 @@
public WebResourceResponse shouldInterceptRequest(WebView view,
String url) {
//intercept if opening a new incognito tab - show the incognito welcome page
- if (url.startsWith("chrome://incognito")) {
+
+ // show only incognito content and webview has private
+ // and cannot go back(only supported if explicit from UI )
+ if (view.isPrivateBrowsingEnabled() &&
+ !view.canGoBack() &&
+ url.startsWith(Controller.INCOGNITO_URI) ) {
Resources resourceHandle = mContext.getResources();
InputStream inStream = resourceHandle.openRawResource(
com.android.browser.R.raw.incognito_mode_start_page);