Reload page on settings change

- Reload current webpage when user tweaks browser settings

CR-Fixed: 5570

Change-Id: I643b857b23e2f39e6f54c3d38eb83622e0794d96
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index a30cdca..81da696 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -16,6 +16,7 @@
 
 package com.android.browser;
 
+import android.net.Uri;
 import android.os.Bundle;
 import android.util.Log;
 
@@ -38,6 +39,31 @@
     private static final String POSITIONS = "positions";
     private static final String CURRENT = "current";
 
+
+    /*
+    Find and reload any live tabs that have loaded the given URL.
+    Note - Upto 2 tabs are live at any given moment.
+     */
+    public void findAndReload(String origin) {
+        for (Tab tab : mTabs){
+            if (tab.getWebView() != null) {
+                Uri url = Uri.parse(tab.getWebView().getUrl());
+                if (url.getHost().equals(origin)){
+                    tab.getWebView().reload();
+                }
+            }
+        }
+    }
+
+    // Reload the all the live tabs
+    public void reloadLiveTabs() {
+        for (Tab tab : mTabs) {
+            if (tab.getWebView() != null) {
+                tab.getWebView().reload();
+            }
+        }
+    }
+
     public static interface OnThumbnailUpdatedListener {
         void onThumbnailUpdated(Tab t);
     }