summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/AutologinBar.java146
-rw-r--r--src/com/android/browser/BaseUi.java15
-rw-r--r--src/com/android/browser/BrowserSettings.java3
-rw-r--r--src/com/android/browser/Controller.java27
-rw-r--r--src/com/android/browser/DeviceAccountLogin.java143
-rw-r--r--src/com/android/browser/GoogleAccountLogin.java296
-rw-r--r--src/com/android/browser/PreloadController.java10
-rw-r--r--src/com/android/browser/Tab.java28
-rw-r--r--src/com/android/browser/TitleBar.java77
-rw-r--r--src/com/android/browser/UI.java4
-rw-r--r--src/com/android/browser/WebViewController.java4
-rw-r--r--src/com/android/browser/preferences/DebugPreferencesFragment.java10
12 files changed, 1 insertions, 762 deletions
diff --git a/src/com/android/browser/AutologinBar.java b/src/com/android/browser/AutologinBar.java
deleted file mode 100644
index 3bbfcd96..00000000
--- a/src/com/android/browser/AutologinBar.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.browser;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.ContextThemeWrapper;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.LinearLayout;
-import android.widget.ProgressBar;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-import com.android.browser.R;
-import com.android.browser.DeviceAccountLogin.AutoLoginCallback;
-
-public class AutologinBar extends LinearLayout implements OnClickListener,
- AutoLoginCallback {
-
- protected Spinner mAutoLoginAccount;
- protected Button mAutoLoginLogin;
- protected ProgressBar mAutoLoginProgress;
- protected TextView mAutoLoginError;
- protected View mAutoLoginCancel;
- protected DeviceAccountLogin mAutoLoginHandler;
- protected ArrayAdapter<String> mAccountsAdapter;
- protected TitleBar mTitleBar;
-
- public AutologinBar(Context context) {
- super(context);
- }
-
- public AutologinBar(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public AutologinBar(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mAutoLoginAccount = (Spinner) findViewById(R.id.autologin_account);
- mAutoLoginLogin = (Button) findViewById(R.id.autologin_login);
- mAutoLoginLogin.setOnClickListener(this);
- mAutoLoginProgress = (ProgressBar) findViewById(R.id.autologin_progress);
- mAutoLoginError = (TextView) findViewById(R.id.autologin_error);
- mAutoLoginCancel = findViewById(R.id.autologin_close);
- mAutoLoginCancel.setOnClickListener(this);
- }
-
- public void setTitleBar(TitleBar titleBar) {
- mTitleBar = titleBar;
- }
-
- @Override
- public void onClick(View v) {
- if (mAutoLoginCancel == v) {
- if (mAutoLoginHandler != null) {
- mAutoLoginHandler.cancel();
- mAutoLoginHandler = null;
- }
- hideAutoLogin(true);
- } else if (mAutoLoginLogin == v) {
- if (mAutoLoginHandler != null) {
- mAutoLoginAccount.setEnabled(false);
- mAutoLoginLogin.setEnabled(false);
- mAutoLoginProgress.setVisibility(View.VISIBLE);
- mAutoLoginError.setVisibility(View.GONE);
- mAutoLoginHandler.login(
- mAutoLoginAccount.getSelectedItemPosition(), this);
- }
- }
- }
-
- public void updateAutoLogin(Tab tab, boolean animate) {
- DeviceAccountLogin login = tab.getDeviceAccountLogin();
- if (login != null) {
- mAutoLoginHandler = login;
- ContextThemeWrapper wrapper = new ContextThemeWrapper(getContext(),
- android.R.style.Theme_Holo_Light);
- mAccountsAdapter = new ArrayAdapter<String>(wrapper,
- android.R.layout.simple_spinner_item, login.getAccountNames());
- mAccountsAdapter.setDropDownViewResource(
- android.R.layout.simple_spinner_dropdown_item);
- mAutoLoginAccount.setAdapter(mAccountsAdapter);
- mAutoLoginAccount.setSelection(0);
- mAutoLoginAccount.setEnabled(true);
- mAutoLoginLogin.setEnabled(true);
- mAutoLoginProgress.setVisibility(View.INVISIBLE);
- mAutoLoginError.setVisibility(View.GONE);
- switch (login.getState()) {
- case DeviceAccountLogin.PROCESSING:
- mAutoLoginAccount.setEnabled(false);
- mAutoLoginLogin.setEnabled(false);
- mAutoLoginProgress.setVisibility(View.VISIBLE);
- break;
- case DeviceAccountLogin.FAILED:
- mAutoLoginProgress.setVisibility(View.INVISIBLE);
- mAutoLoginError.setVisibility(View.VISIBLE);
- break;
- case DeviceAccountLogin.INITIAL:
- break;
- default:
- throw new IllegalStateException();
- }
- showAutoLogin(animate);
- } else {
- hideAutoLogin(animate);
- }
- }
-
- void showAutoLogin(boolean animate) {
- mTitleBar.showAutoLogin(animate);
- }
-
- void hideAutoLogin(boolean animate) {
- mTitleBar.hideAutoLogin(animate);
- }
-
- @Override
- public void loginFailed() {
- mAutoLoginAccount.setEnabled(true);
- mAutoLoginLogin.setEnabled(true);
- mAutoLoginProgress.setVisibility(View.INVISIBLE);
- mAutoLoginError.setVisibility(View.VISIBLE);
- }
-
-}
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index f5ccb427..2b4b1709 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -298,7 +298,6 @@ public abstract class BaseUi implements UI {
onTabDataChanged(tab);
onProgressChanged(tab);
mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled());
- updateAutoLogin(tab, false);
mBlockFocusAnimations = false;
}
@@ -573,25 +572,11 @@ public abstract class BaseUi implements UI {
return mCustomView == null;
}
- @Override
- public void showAutoLogin(Tab tab) {
- updateAutoLogin(tab, true);
- }
-
- @Override
- public void hideAutoLogin(Tab tab) {
- updateAutoLogin(tab, true);
- }
-
// -------------------------------------------------------------------------
protected void updateNavigationState(Tab tab) {
}
- protected void updateAutoLogin(Tab tab, boolean animate) {
- mTitleBar.updateAutoLogin(tab, animate);
- }
-
/**
* Update the lock icon to correspond to our latest state.
*/
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 319ded5f..34ba56ba 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -621,11 +621,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
}
public void resetDefaultPreferences() {
- // Preserve autologin setting
- long gal = mPrefs.getLong(GoogleAccountLogin.PREF_AUTOLOGIN_TIME, -1);
mPrefs.edit()
.clear()
- .putLong(GoogleAccountLogin.PREF_AUTOLOGIN_TIME, gal)
.apply();
resetCachedValues();
syncManagedSettings();
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index c3553d49..4d96cf54 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -325,20 +325,6 @@ public class Controller
// must do this before trying to login the user as we don't want to
// clear any session cookies set during login.
CookieManager.getInstance().removeSessionCookie();
- }
-
- GoogleAccountLogin.startLoginIfNeeded(mActivity,
- new Runnable() {
- @Override public void run() {
- onPreloginFinished(icicle, intent, currentTabId,
- restoreIncognitoTabs);
- }
- });
- }
-
- private void onPreloginFinished(Bundle icicle, Intent intent, long currentTabId,
- boolean restoreIncognitoTabs) {
- if (currentTabId == -1) {
BackgroundHandler.execute(new PruneThumbnails(mActivity, null));
if (intent == null) {
// This won't happen under common scenarios. The icicle is
@@ -1255,19 +1241,6 @@ public class Controller
mPageDialogsHandler.showSSLCertificateOnError(view, handler, error);
}
- @Override
- public void showAutoLogin(Tab tab) {
- assert tab.inForeground();
- // Update the title bar to show the auto-login request.
- mUi.showAutoLogin(tab);
- }
-
- @Override
- public void hideAutoLogin(Tab tab) {
- assert tab.inForeground();
- mUi.hideAutoLogin(tab);
- }
-
// helper method
/*
diff --git a/src/com/android/browser/DeviceAccountLogin.java b/src/com/android/browser/DeviceAccountLogin.java
deleted file mode 100644
index 0638f97e..00000000
--- a/src/com/android/browser/DeviceAccountLogin.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.browser;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.app.Activity;
-import android.os.Bundle;
-import org.codeaurora.swe.WebView;
-
-public class DeviceAccountLogin implements
- AccountManagerCallback<Bundle> {
-
- private final Activity mActivity;
- private final WebView mWebView;
- private final Tab mTab;
- private final WebViewController mWebViewController;
- private final AccountManager mAccountManager;
- Account[] mAccounts;
- private AutoLoginCallback mCallback;
- private String mAuthToken;
-
- // Current state of the login.
- private int mState = INITIAL;
-
- public static final int INITIAL = 0;
- public static final int FAILED = 1;
- public static final int PROCESSING = 2;
-
- public interface AutoLoginCallback {
- public void loginFailed();
- }
-
- public DeviceAccountLogin(Activity activity, WebView view, Tab tab,
- WebViewController controller) {
- mActivity = activity;
- mWebView = view;
- mTab = tab;
- mWebViewController = controller;
- mAccountManager = AccountManager.get(activity);
- }
-
- public void handleLogin(String realm, String account, String args) {
- mAccounts = mAccountManager.getAccountsByType(realm);
- mAuthToken = "weblogin:" + args;
-
- // No need to display UI if there are no accounts.
- if (mAccounts.length == 0) {
- return;
- }
-
- // Verify the account before using it.
- for (Account a : mAccounts) {
- if (a.name.equals(account)) {
- // Handle the automatic login case where the service gave us an
- // account to use.
- mAccountManager.getAuthToken(a, mAuthToken, null,
- mActivity, this, null);
- return;
- }
- }
-
- displayLoginUi();
- }
-
- @Override
- public void run(AccountManagerFuture<Bundle> value) {
- try {
- String result = value.getResult().getString(
- AccountManager.KEY_AUTHTOKEN);
- if (result == null) {
- loginFailed();
- } else {
- mWebView.loadUrl(result);
- mTab.setDeviceAccountLogin(null);
- if (mTab.inForeground()) {
- mWebViewController.hideAutoLogin(mTab);
- }
- }
- } catch (Exception e) {
- loginFailed();
- }
- }
-
- public int getState() {
- return mState;
- }
-
- private void loginFailed() {
- mState = FAILED;
- if (mTab.getDeviceAccountLogin() == null) {
- displayLoginUi();
- } else {
- if (mCallback != null) {
- mCallback.loginFailed();
- }
- }
- }
-
- private void displayLoginUi() {
- // Display the account picker.
- mTab.setDeviceAccountLogin(this);
- if (mTab.inForeground()) {
- mWebViewController.showAutoLogin(mTab);
- }
- }
-
- public void cancel() {
- mTab.setDeviceAccountLogin(null);
- }
-
- public void login(int accountIndex, AutoLoginCallback cb) {
- mState = PROCESSING;
- mCallback = cb;
- mAccountManager.getAuthToken(
- mAccounts[accountIndex], mAuthToken, null,
- mActivity, this, null);
- }
-
- public String[] getAccountNames() {
- String[] names = new String[mAccounts.length];
- for (int i = 0; i < mAccounts.length; i++) {
- names[i] = mAccounts[i].name;
- }
- return names;
- }
-}
diff --git a/src/com/android/browser/GoogleAccountLogin.java b/src/com/android/browser/GoogleAccountLogin.java
deleted file mode 100644
index f6056719..00000000
--- a/src/com/android/browser/GoogleAccountLogin.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.browser;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnCancelListener;
-import android.content.SharedPreferences.Editor;
-import android.net.Uri;
-import android.net.http.AndroidHttpClient;
-import android.os.Bundle;
-import android.util.Log;
-import org.codeaurora.swe.CookieSyncManager;
-import org.codeaurora.swe.WebView;
-import org.codeaurora.swe.WebViewClient;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.util.EntityUtils;
-
-import com.android.browser.R;
-
-public class GoogleAccountLogin implements Runnable,
- AccountManagerCallback<Bundle>, OnCancelListener {
-
- private static final String LOGTAG = "BrowserLogin";
-
- // Url for issuing the uber token.
- private Uri ISSUE_AUTH_TOKEN_URL = Uri.parse(
- "https://www.google.com/accounts/IssueAuthToken?service=gaia&Session=false");
- // Url for signing into a particular service.
- private static final Uri TOKEN_AUTH_URL = Uri.parse(
- "https://www.google.com/accounts/TokenAuth");
- // Google account type
- private static final String GOOGLE = "com.google";
- // Last auto login time
- public static final String PREF_AUTOLOGIN_TIME = "last_autologin_time";
-
- private final Activity mActivity;
- private final Account mAccount;
- private final WebView mWebView;
- private Runnable mRunnable;
- private ProgressDialog mProgressDialog;
-
- // SID and LSID retrieval process.
- private String mSid;
- private String mLsid;
- private int mState; // {NONE(0), SID(1), LSID(2)}
- private boolean mTokensInvalidated;
- private String mUserAgent;
-
- private GoogleAccountLogin(Activity activity, Account account,
- Runnable runnable) {
- mActivity = activity;
- mAccount = account;
- mWebView = new WebView(mActivity);
- mRunnable = runnable;
- mUserAgent = mWebView.getSettings().getUserAgentString();
-
- // XXX: Doing pre-login causes onResume to skip calling
- // resumeWebViewTimers. So to avoid problems with timers not running, we
- // duplicate the work here using the off-screen WebView.
- CookieSyncManager.getInstance().startSync();
- WebViewTimersControl.getInstance().onBrowserActivityResume(mWebView);
-
- mWebView.setWebViewClient(new WebViewClient() {
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- return false;
- }
- @Override
- public void onPageFinished(WebView view, String url) {
- done();
- }
- });
- }
-
- private void saveLoginTime() {
- Editor ed = BrowserSettings.getInstance().getPreferences().edit();
- ed.putLong(PREF_AUTOLOGIN_TIME, System.currentTimeMillis());
- ed.apply();
- }
-
- // Runnable
- @Override
- public void run() {
- String url = ISSUE_AUTH_TOKEN_URL.buildUpon()
- .appendQueryParameter("SID", mSid)
- .appendQueryParameter("LSID", mLsid)
- .build().toString();
- // Intentionally not using Proxy.
- AndroidHttpClient client = AndroidHttpClient.newInstance(mUserAgent);
- HttpPost request = new HttpPost(url);
-
- String result = null;
- try {
- HttpResponse response = client.execute(request);
- int status = response.getStatusLine().getStatusCode();
- if (status != HttpStatus.SC_OK) {
- Log.d(LOGTAG, "LOGIN_FAIL: Bad status from auth url "
- + status + ": "
- + response.getStatusLine().getReasonPhrase());
- // Invalidate the tokens once just in case the 403 was for other
- // reasons.
- if (status == HttpStatus.SC_FORBIDDEN && !mTokensInvalidated) {
- Log.d(LOGTAG, "LOGIN_FAIL: Invalidating tokens...");
- // Need to regenerate the auth tokens and try again.
- invalidateTokens();
- // XXX: Do not touch any more member variables from this
- // thread as a second thread will handle the next login
- // attempt.
- return;
- }
- done();
- return;
- }
- HttpEntity entity = response.getEntity();
- if (entity == null) {
- Log.d(LOGTAG, "LOGIN_FAIL: Null entity in response");
- done();
- return;
- }
- result = EntityUtils.toString(entity, "UTF-8");
- } catch (Exception e) {
- Log.d(LOGTAG, "LOGIN_FAIL: Exception acquiring uber token " + e);
- request.abort();
- done();
- return;
- } finally {
- client.close();
- }
- final String newUrl = TOKEN_AUTH_URL.buildUpon()
- .appendQueryParameter("source", "android-browser")
- .appendQueryParameter("auth", result)
- .appendQueryParameter("continue",
- BrowserSettings.getFactoryResetHomeUrl(mActivity))
- .build().toString();
- mActivity.runOnUiThread(new Runnable() {
- @Override public void run() {
- // Check mRunnable in case the request has been canceled. This
- // is most likely not necessary as run() is the only non-UI
- // thread that calls done() but I am paranoid.
- synchronized (GoogleAccountLogin.this) {
- if (mRunnable == null) {
- return;
- }
- mWebView.loadUrl(newUrl);
- }
- }
- });
- }
-
- private void invalidateTokens() {
- AccountManager am = AccountManager.get(mActivity);
- am.invalidateAuthToken(GOOGLE, mSid);
- am.invalidateAuthToken(GOOGLE, mLsid);
- mTokensInvalidated = true;
- mState = 1; // SID
- am.getAuthToken(mAccount, "SID", null, mActivity, this, null);
- }
-
- // AccountManager callbacks.
- @Override
- public void run(AccountManagerFuture<Bundle> value) {
- try {
- String id = value.getResult().getString(
- AccountManager.KEY_AUTHTOKEN);
- switch (mState) {
- default:
- case 0:
- throw new IllegalStateException(
- "Impossible to get into this state");
- case 1:
- mSid = id;
- mState = 2; // LSID
- AccountManager.get(mActivity).getAuthToken(
- mAccount, "LSID", null, mActivity, this, null);
- break;
- case 2:
- mLsid = id;
- new Thread(this).start();
- break;
- }
- } catch (Exception e) {
- Log.d(LOGTAG, "LOGIN_FAIL: Exception in state " + mState + " " + e);
- // For all exceptions load the original signin page.
- // TODO: toast login failed?
- done();
- }
- }
-
- // Start the login process if auto-login is enabled and the user is not
- // already logged in.
- public static void startLoginIfNeeded(Activity activity,
- Runnable runnable) {
- // Already logged in?
- if (isLoggedIn()) {
- runnable.run();
- return;
- }
-
- // No account found?
- Account[] accounts = getAccounts(activity);
- if (accounts == null || accounts.length == 0) {
- runnable.run();
- return;
- }
-
- GoogleAccountLogin login =
- new GoogleAccountLogin(activity, accounts[0], runnable);
- login.startLogin();
- }
-
- private void startLogin() {
- saveLoginTime();
- mProgressDialog = ProgressDialog.show(mActivity,
- mActivity.getString(R.string.pref_autologin_title),
- mActivity.getString(R.string.pref_autologin_progress,
- mAccount.name),
- true /* indeterminate */,
- true /* cancelable */,
- this);
- mState = 1; // SID
- AccountManager.get(mActivity).getAuthToken(
- mAccount, "SID", null, mActivity, this, null);
- }
-
- private static Account[] getAccounts(Context ctx) {
- return AccountManager.get(ctx).getAccountsByType(GOOGLE);
- }
-
- // Checks if we already did pre-login.
- private static boolean isLoggedIn() {
- // See if we last logged in less than a week ago.
- long lastLogin = BrowserSettings.getInstance().getPreferences()
- .getLong(PREF_AUTOLOGIN_TIME, -1);
- if (lastLogin == -1) {
- return false;
- }
- return true;
- }
-
- // Used to indicate that the Browser should continue loading the main page.
- // This can happen on success, error, or timeout.
- private synchronized void done() {
- if (mRunnable != null) {
- Log.d(LOGTAG, "Finished login attempt for " + mAccount.name);
- mActivity.runOnUiThread(mRunnable);
-
- try {
- mProgressDialog.dismiss();
- } catch (Exception e) {
- // TODO: Switch to a managed dialog solution (DialogFragment?)
- // Also refactor this class, it doesn't
- // play nice with the activity lifecycle, leading to issues
- // with the dialog it manages
- Log.w(LOGTAG, "Failed to dismiss mProgressDialog: " + e.getMessage());
- }
- mRunnable = null;
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- mWebView.destroy();
- }
- });
- }
- }
-
- // Called by the progress dialog on startup.
- public void onCancel(DialogInterface unused) {
- done();
- }
-
-}
diff --git a/src/com/android/browser/PreloadController.java b/src/com/android/browser/PreloadController.java
index b5643187..3290611c 100644
--- a/src/com/android/browser/PreloadController.java
+++ b/src/com/android/browser/PreloadController.java
@@ -256,16 +256,6 @@ public class PreloadController implements WebViewController {
}
@Override
- public void showAutoLogin(Tab tab) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "showAutoLogin()");
- }
-
- @Override
- public void hideAutoLogin(Tab tab) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "hideAutoLogin()");
- }
-
- @Override
public boolean shouldCaptureThumbnails() {
return false;
}
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 6d36d9c9..4889efe2 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -185,8 +185,6 @@ class Tab implements PictureListener {
// Listener used to know when we move forward or back in the history list.
private final WebBackForwardListClient mWebBackForwardListClient;
private DataController mDataController;
- // State of the auto-login request.
- private DeviceAccountLogin mDeviceAccountLogin;
// AsyncTask for downloading touch icons
DownloadTouchIcon mTouchIconLoader;
@@ -399,13 +397,6 @@ class Tab implements PictureListener {
}
}
- // Cancel the auto-login process.
- if (mDeviceAccountLogin != null) {
- mDeviceAccountLogin.cancel();
- mDeviceAccountLogin = null;
- mWebViewController.hideAutoLogin(Tab.this);
- }
-
// finally update the UI in the activity if it is in the foreground
mWebViewController.onPageStarted(Tab.this, view, favicon);
@@ -706,14 +697,6 @@ class Tab implements PictureListener {
super.onUnhandledKeyEvent(view, event);
}
}
-
- @Override
- public void onReceivedLoginRequest(WebView view, String realm,
- String account, String args) {
- new DeviceAccountLogin(mWebViewController.getActivity(), view, Tab.this, mWebViewController)
- .handleLogin(realm, account, args);
- }
-
};
private void syncCurrentState(WebView view, String url) {
@@ -734,17 +717,6 @@ class Tab implements PictureListener {
mCurrentState.mIncognito = view.isPrivateBrowsingEnabled();
}
- // Called by DeviceAccountLogin when the Tab needs to have the auto-login UI
- // displayed.
- void setDeviceAccountLogin(DeviceAccountLogin login) {
- mDeviceAccountLogin = login;
- }
-
- // Returns non-null if the title bar should display the auto-login UI.
- DeviceAccountLogin getDeviceAccountLogin() {
- return mDeviceAccountLogin;
- }
-
// -------------------------------------------------------------------------
// WebChromeClient implementation for the main WebView
// -------------------------------------------------------------------------
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 1f9ec231..7438d26b 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -53,7 +53,6 @@ public class TitleBar extends RelativeLayout {
private PageProgressView mProgress;
private AccessibilityManager mAccessibilityManager;
- private AutologinBar mAutoLogin;
private NavigationBarBase mNavBar;
private boolean mUseQuickControls;
private SnapshotBar mSnapshotBar;
@@ -84,16 +83,6 @@ public class TitleBar extends RelativeLayout {
mNavBar.setTitleBar(this);
}
- private void inflateAutoLoginBar() {
- if (mAutoLogin != null) {
- return;
- }
-
- ViewStub stub = (ViewStub) findViewById(R.id.autologin_stub);
- mAutoLogin = (AutologinBar) stub.inflate();
- mAutoLogin.setTitleBar(this);
- }
-
private void inflateSnapshotBar() {
if (mSnapshotBar != null) {
return;
@@ -309,78 +298,14 @@ public class TitleBar extends RelativeLayout {
int calculateEmbeddedHeight() {
int height = mNavBar.getHeight();
- if (mAutoLogin != null && mAutoLogin.getVisibility() == View.VISIBLE) {
- height += mAutoLogin.getHeight();
- }
return height;
}
- public void updateAutoLogin(Tab tab, boolean animate) {
- if (mAutoLogin == null) {
- if (tab.getDeviceAccountLogin() == null) {
- return;
- }
- inflateAutoLoginBar();
- }
- mAutoLogin.updateAutoLogin(tab, animate);
- }
-
- public void showAutoLogin(boolean animate) {
- if (mUseQuickControls) {
- mBaseUi.showTitleBar();
- }
- if (mAutoLogin == null) {
- inflateAutoLoginBar();
- }
- mAutoLogin.setVisibility(View.VISIBLE);
- if (animate) {
- mAutoLogin.startAnimation(AnimationUtils.loadAnimation(
- getContext(), R.anim.autologin_enter));
- }
- }
-
- public void hideAutoLogin(boolean animate) {
- if (mUseQuickControls) {
- mBaseUi.hideTitleBar();
- mAutoLogin.setVisibility(View.GONE);
- mBaseUi.refreshWebView();
- } else {
- if (animate) {
- Animation anim = AnimationUtils.loadAnimation(getContext(),
- R.anim.autologin_exit);
- anim.setAnimationListener(new AnimationListener() {
- @Override
- public void onAnimationEnd(Animation a) {
- mAutoLogin.setVisibility(View.GONE);
- mBaseUi.refreshWebView();
- }
-
- @Override
- public void onAnimationStart(Animation a) {
- }
-
- @Override
- public void onAnimationRepeat(Animation a) {
- }
- });
- mAutoLogin.startAnimation(anim);
- } else if (mAutoLogin.getAnimation() == null) {
- mAutoLogin.setVisibility(View.GONE);
- mBaseUi.refreshWebView();
- }
- }
- }
-
public boolean wantsToBeVisible() {
- return inAutoLogin()
- || (mSnapshotBar != null && mSnapshotBar.getVisibility() == View.VISIBLE
+ return (mSnapshotBar != null && mSnapshotBar.getVisibility() == View.VISIBLE
&& mSnapshotBar.isAnimating());
}
- private boolean inAutoLogin() {
- return mAutoLogin != null && mAutoLogin.getVisibility() == View.VISIBLE;
- }
-
public boolean isEditingUrl() {
return mNavBar.isEditingUrl();
}
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 00dacdb3..70f0880d 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -136,10 +136,6 @@ public interface UI {
boolean dispatchKey(int code, KeyEvent event);
- void showAutoLogin(Tab tab);
-
- void hideAutoLogin(Tab tab);
-
void setFullscreen(boolean enabled);
void setUseQuickControls(boolean enabled);
diff --git a/src/com/android/browser/WebViewController.java b/src/com/android/browser/WebViewController.java
index 6864470a..c5e3bc00 100644
--- a/src/com/android/browser/WebViewController.java
+++ b/src/com/android/browser/WebViewController.java
@@ -116,9 +116,5 @@ public interface WebViewController {
void bookmarkedStatusHasChanged(Tab tab);
- void showAutoLogin(Tab tab);
-
- void hideAutoLogin(Tab tab);
-
boolean shouldCaptureThumbnails();
}
diff --git a/src/com/android/browser/preferences/DebugPreferencesFragment.java b/src/com/android/browser/preferences/DebugPreferencesFragment.java
index 24821d16..3a0b32f6 100644
--- a/src/com/android/browser/preferences/DebugPreferencesFragment.java
+++ b/src/com/android/browser/preferences/DebugPreferencesFragment.java
@@ -22,7 +22,6 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceFragment;
import com.android.browser.BrowserSettings;
-import com.android.browser.GoogleAccountLogin;
import com.android.browser.PreferenceKeys;
import com.android.browser.R;
@@ -34,19 +33,10 @@ public class DebugPreferencesFragment extends PreferenceFragment
// Load the XML preferences file
addPreferencesFromResource(R.xml.debug_preferences);
-
- Preference e = findPreference(PreferenceKeys.PREF_RESET_PRELOGIN);
- e.setOnPreferenceClickListener(this);
}
@Override
public boolean onPreferenceClick(Preference preference) {
- if (PreferenceKeys.PREF_RESET_PRELOGIN.equals(preference.getKey())) {
- BrowserSettings.getInstance().getPreferences().edit()
- .remove(GoogleAccountLogin.PREF_AUTOLOGIN_TIME)
- .apply();
- return true;
- }
return false;
}
}