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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninActivity.java

Issue 1698043006: Created the dialog offering the user to merge their account data or keep it (Closed) Base URL: maybelle.lon.corp.google.com:/usr/local/google/code/clankium/src@sync_settings
Patch Set: Created 4 years, 10 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/signin/AccountSigninActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b262feffabd24589c38a5a47561208061e2de31
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninActivity.java
@@ -0,0 +1,118 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.signin;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.LayoutInflater;
+
+import org.chromium.base.Log;
+import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.base.library_loader.ProcessInitException;
+import org.chromium.base.metrics.RecordUserAction;
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.firstrun.ProfileDataCache;
+import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
+import org.chromium.chrome.browser.preferences.Preferences;
+import org.chromium.chrome.browser.preferences.PreferencesLauncher;
+import org.chromium.chrome.browser.profiles.Profile;
+import org.chromium.chrome.browser.sync.ui.SyncCustomizationFragment;
+
+/**
+ * An Activity displayed from the MainPreferences to allow the user to pick an account to
+ * sign in to. The AccountSigninView.Delegate interface is fulfilled by the AppCompatActivity.
+ */
+public class AccountSigninActivity extends AppCompatActivity
+ implements AccountSigninView.Listener, AccountSigninView.Delegate,
+ SigninManager.SignInCallback{
+ private static final String TAG = "SigninActivity";
+
+ private static final String CONFIRM_IMPORT_SYNC_DATA_DIALOG_TAG =
+ "signin_import_data_tag";
+
+ private AccountSigninView mView;
+ private String mAccountName;
+ private boolean mShowSyncSettings = false;
+
+ @Override
+ @SuppressFBWarnings("DM_EXIT")
+ protected void onCreate(Bundle savedInstanceState) {
+ // The browser process must be started here because this activity may be started from the
+ // recent apps list and it relies on other activities and the native library to be loaded.
+ try {
+ ChromeBrowserInitializer.getInstance(this).handleSynchronousStartup();
+ } catch (ProcessInitException e) {
+ Log.e(TAG, "Failed to start browser process.", e);
+ // Since the library failed to initialize nothing in the application
+ // can work, so kill the whole application not just the activity
+ System.exit(-1);
+ }
+
+ super.onCreate(savedInstanceState);
+
+ mView = (AccountSigninView) LayoutInflater.from(this).inflate(
+ R.layout.account_signin_view, null);
+ mView.init(new ProfileDataCache(this, Profile.getLastUsedProfile()));
+ mView.setListener(this);
+ mView.setDelegate(this);
+
+ setContentView(mView);
+ }
+
+ @Override
+ public void onAccountSelectionCanceled() {
gogerald1 2016/02/26 01:02:04 Please RecordUserAction.record("Signin_Declined_Fr
+ finish();
+ }
+
+ @Override
+ public void onNewAccount() {
+ AccountAdder.getInstance().addAccount(this, AccountAdder.ADD_ACCOUNT_RESULT);
+ }
+
+ @Override
+ public void onAccountSelected(String accountName) {
+ mAccountName = accountName;
+
+ }
+
+ @Override
+ public void onDoneClicked() {
+ RecordUserAction.record("Signin_Signin_FromSettings");
+ SigninManager.get(this).signIn(mAccountName, this, this);
+ }
+
+ @Override
+ public void onSettingsClicked() {
+ RecordUserAction.record("Signin_Signin_FromSettings");
+ mShowSyncSettings = true;
+ SigninManager.get(this).signIn(mAccountName, this, this);
+ }
+
+ @Override
+ public void onFailedToSetForcedAccount(String forcedAccountName) {
+ assert false : "No forced accounts in account switching preferences.";
+
+ }
+
+ @Override
+ public void onSignInComplete() {
+ if (mShowSyncSettings) {
+ Intent intent = PreferencesLauncher.createIntentForSettingsPage(this,
+ SyncCustomizationFragment.class.getName());
+ Bundle args = new Bundle();
+ args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, mAccountName);
+ intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
+ startActivity(intent);
+ }
+
+ finish();
+ }
+
+ @Override
+ public void onSignInAborted() {
+ assert false : "Signin cannot be aborted when forced.";
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698