| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
| 6 | 6 |
| 7 import android.app.Fragment; | 7 import android.app.Fragment; |
| 8 import android.os.Bundle; | 8 import android.os.Bundle; |
| 9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
| 10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 String forcedAccountName = | 74 String forcedAccountName = |
| 75 getProperties().getString(FORCE_SIGNIN_ACCOUNT_TO); | 75 getProperties().getString(FORCE_SIGNIN_ACCOUNT_TO); |
| 76 if (!TextUtils.isEmpty(forcedAccountName)) { | 76 if (!TextUtils.isEmpty(forcedAccountName)) { |
| 77 mView.switchToForcedAccountMode(forcedAccountName); | 77 mView.switchToForcedAccountMode(forcedAccountName); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 @Override | 81 @Override |
| 82 public void onStart() { | 82 public void onStart() { |
| 83 super.onStart(); | 83 super.onStart(); |
| 84 mView.setProfileDataCache(getPageDelegate().getProfileDataCache()); | |
| 85 getPageDelegate().onSigninDialogShown(); | 84 getPageDelegate().onSigninDialogShown(); |
| 86 } | 85 } |
| 87 | 86 |
| 88 // FirstRunPage: | 87 // FirstRunPage: |
| 89 | 88 |
| 90 @Override | 89 @Override |
| 91 public boolean interceptBackPressed() { | 90 public boolean interceptBackPressed() { |
| 92 if (!mView.isSignedIn() | 91 if (!mView.isSignedIn() |
| 93 || (mView.isInForcedAccountMode() | 92 || (mView.isInForcedAccountMode() |
| 94 && !getProperties().getBoolean(PRESELECT_BUT_ALLOW_T
O_CHANGE))) { | 93 && !getProperties().getBoolean(PRESELECT_BUT_ALLOW_T
O_CHANGE))) { |
| 95 return super.interceptBackPressed(); | 94 return super.interceptBackPressed(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 if (mView.isInForcedAccountMode() | 97 if (mView.isInForcedAccountMode() |
| 99 && getProperties().getBoolean(PRESELECT_BUT_ALLOW_TO_CHANGE)) { | 98 && getProperties().getBoolean(PRESELECT_BUT_ALLOW_TO_CHANGE)) { |
| 100 // Allow the user to choose the account or refuse to sign in, | 99 // Allow the user to choose the account or refuse to sign in, |
| 101 // and re-create this fragment. | 100 // and re-create this fragment. |
| 102 getProperties().remove(FORCE_SIGNIN_ACCOUNT_TO); | 101 getProperties().remove(FORCE_SIGNIN_ACCOUNT_TO); |
| 103 } | 102 } |
| 104 | 103 |
| 105 // Re-create the fragment if the user presses the back button when in si
gned in mode. | 104 // Re-create the fragment if the user presses the back button when in si
gned in mode. |
| 106 // The fragment is re-created in the normal (signed out) mode. | 105 // The fragment is re-created in the normal (signed out) mode. |
| 107 getPageDelegate().recreateCurrentPage(); | 106 getPageDelegate().recreateCurrentPage(); |
| 108 return true; | 107 return true; |
| 109 } | 108 } |
| 110 } | 109 } |
| OLD | NEW |