Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2627)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java

Issue 2245733004: Serve offline page for online URL on disconnected or bad networks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix junit test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
index 15bba2f6110b25e7908fc707b0d549ff4fc0e606..887429dd3d5b9a6b311ea3fd03a564b687e26457 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -902,7 +902,7 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
mUrlBar.setUrl("", null);
} else {
mUrlBar.setUrl(
- mToolbarDataProvider.getText(), getOnlineUrlFromTab());
+ mToolbarDataProvider.getText(), getCurrentTabUrl());
}
}
}
@@ -2024,7 +2024,7 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
*/
@Override
public void setUrlToPageUrl() {
- String url = getOnlineUrlFromTab();
+ String url = getCurrentTabUrl();
// If the URL is currently focused, do not replace the text they have entered with the URL.
// Once they stop editing the URL, the current tab's URL will automatically be filled in.
@@ -2064,16 +2064,10 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
updateCustomSelectionActionModeCallback();
}
- /**
- * Gets the URL of the web page in the tab. When displaying offline page it gets the URL of the
- * original page.
- */
- private String getOnlineUrlFromTab() {
+ /** Gets the URL of the web page in the tab. */
+ private String getCurrentTabUrl() {
Tab currentTab = getCurrentTab();
if (currentTab == null) return "";
- if (currentTab.isOfflinePage()) {
- return currentTab.getOriginalUrl().trim();
- }
return currentTab.getUrl().trim();
}
@@ -2095,7 +2089,7 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
// AutocompleteResults needed by onSuggestionsSelected. Therefore,
// loadUrl should should be invoked last.
Tab currentTab = getCurrentTab();
- String currentPageUrl = currentTab != null ? currentTab.getUrl() : "";
+ String currentPageUrl = getCurrentTabUrl();
WebContents webContents = currentTab != null ? currentTab.getWebContents() : null;
long elapsedTimeSinceModified = mNewOmniboxEditSessionTimestamp > 0
? (SystemClock.elapsedRealtime() - mNewOmniboxEditSessionTimestamp) : -1;

Powered by Google App Engine
This is Rietveld 408576698