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

Unified Diff: blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java

Issue 1931583004: Prevent Blimp from reloading default URL on resume from minimized state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
index ebeeffc3e70cb3f9e0178b297c65dfad32c311cd..cd830b17b1aba6d5e200fea9d0bc964f633cfaa1 100644
--- a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
@@ -44,6 +44,8 @@ public class BlimpRendererActivity
private TabControlFeature mTabControlFeature;
private WebInputBox mWebInputBox;
+ private boolean mFirstUrlLoadDone = false;
+
@Override
@SuppressFBWarnings("DM_EXIT") // FindBugs doesn't like System.exit().
protected void onCreate(Bundle savedInstanceState) {
@@ -159,13 +161,13 @@ public class BlimpRendererActivity
mTabControlFeature = new TabControlFeature(mBlimpClientSession, mBlimpView);
- handleUrl(getUrlFromIntent(getIntent()));
+ handleUrlFromIntent(getIntent());
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
- handleUrl(getUrlFromIntent(intent));
+ handleUrlFromIntent(intent);
}
/**
@@ -184,19 +186,21 @@ public class BlimpRendererActivity
}
/**
- * Loads the url in the browser.
- * @param url URL to load. If null, browser loads a default page.
+ * Retrieves an URL from an Intent and loads it in the browser.
+ * If the toolbar already has an URL and the new intent doesn't have an URL (e.g. bringing back
+ * from background), the intent gets ignored.
+ * @param intent Intent that contains the URL.
*/
- private void handleUrl(String url) {
+ private void handleUrlFromIntent(Intent intent) {
// TODO(shaktisahu): On a slow device, this might happen. Load the correct URL once the
// toolbar loading is complete (crbug/601226)
if (mToolbar == null) return;
- if (url == null) {
- mToolbar.loadUrl("http://www.google.com/");
- } else {
- mToolbar.loadUrl(url);
- }
+ String url = getUrlFromIntent(intent);
+ if (mFirstUrlLoadDone && url == null) return;
+ mFirstUrlLoadDone = true;
+
+ mToolbar.loadUrl(url == null ? "http://www.google.com/" : url);
}
// TokenSource.Callback implementation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698