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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java

Issue 2360783004: Get FragmentManager directly from AccountSigninView.Delegate. (Closed)
Patch Set: Updated comments. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.signin; 5 package org.chromium.chrome.browser.signin;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.FragmentManager;
8 import android.content.Context; 9 import android.content.Context;
9 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
10 import android.text.TextUtils; 11 import android.text.TextUtils;
11 import android.text.method.LinkMovementMethod; 12 import android.text.method.LinkMovementMethod;
12 import android.util.AttributeSet; 13 import android.util.AttributeSet;
13 import android.view.View; 14 import android.view.View;
14 import android.widget.Button; 15 import android.widget.Button;
15 import android.widget.FrameLayout; 16 import android.widget.FrameLayout;
16 import android.widget.ImageView; 17 import android.widget.ImageView;
17 import android.widget.TextView; 18 import android.widget.TextView;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 public void onFailedToSetForcedAccount(String forcedAccountName); 75 public void onFailedToSetForcedAccount(String forcedAccountName);
75 } 76 }
76 77
77 // TODO(peconn): Investigate expanding the Delegate to simplify the Listener implementations. 78 // TODO(peconn): Investigate expanding the Delegate to simplify the Listener implementations.
78 79
79 /** 80 /**
80 * Provides UI objects for new UI component creation. 81 * Provides UI objects for new UI component creation.
81 */ 82 */
82 public interface Delegate { 83 public interface Delegate {
83 /** 84 /**
84 * Provides an Activity for the view to create dialogs. 85 * Provides an Activity for the View to check GMSCore version.
85 */ 86 */
86 public Activity getActivity(); 87 public Activity getActivity();
88
89 /**
90 * Provides a FragmentManager for the View to create dialogs. This is do ne through a
91 * different mechanism than getActivity().getFragmentManager() as a pote ntial fix to
92 * https://crbug.com/646978 on the theory that getActivity() and getFrag mentManager()
93 * return null at different times.
94 */
95 public FragmentManager getFragmentManager();
87 } 96 }
88 97
89 private static final String TAG = "AccountSigninView"; 98 private static final String TAG = "AccountSigninView";
90 99
91 private static final String SETTINGS_LINK_OPEN = "<LINK1>"; 100 private static final String SETTINGS_LINK_OPEN = "<LINK1>";
92 private static final String SETTINGS_LINK_CLOSE = "</LINK1>"; 101 private static final String SETTINGS_LINK_CLOSE = "</LINK1>";
93 102
94 private AccountManagerHelper mAccountManagerHelper; 103 private AccountManagerHelper mAccountManagerHelper;
95 private List<String> mAccountNames; 104 private List<String> mAccountNames;
96 private AccountSigninChooseView mSigninChooseView; 105 private AccountSigninChooseView mSigninChooseView;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 258
250 mProfileData.update(); 259 mProfileData.update();
251 260
252 // Determine how the accounts have changed. Each list should only have u nique elements. 261 // Determine how the accounts have changed. Each list should only have u nique elements.
253 if (oldAccountNames == null || oldAccountNames.isEmpty()) return; 262 if (oldAccountNames == null || oldAccountNames.isEmpty()) return;
254 263
255 if (!mAccountNames.get(accountToSelect).equals(oldAccountNames.get(oldSe lectedAccount))) { 264 if (!mAccountNames.get(accountToSelect).equals(oldAccountNames.get(oldSe lectedAccount))) {
256 // Any dialogs that may have been showing are now invalid (they were created for the 265 // Any dialogs that may have been showing are now invalid (they were created for the
257 // previously selected account). 266 // previously selected account).
258 ConfirmSyncDataStateMachine 267 ConfirmSyncDataStateMachine
259 .cancelAllDialogs(mDelegate.getActivity().getFragmentManager ()); 268 .cancelAllDialogs(mDelegate.getFragmentManager());
260 269
261 if (mAccountNames.containsAll(oldAccountNames)) { 270 if (mAccountNames.containsAll(oldAccountNames)) {
262 // A new account has been added and no accounts have been delete d. We will have 271 // A new account has been added and no accounts have been delete d. We will have
263 // changed the account selection to the newly added account, so shortcut to the 272 // changed the account selection to the newly added account, so shortcut to the
264 // confirm signin page. 273 // confirm signin page.
265 showConfirmSigninPageAccountTrackerServiceCheck(); 274 showConfirmSigninPageAccountTrackerServiceCheck();
266 } 275 }
267 } 276 }
268 } 277 }
269 278
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 @Override 388 @Override
380 public void onSystemAccountsChanged() {} 389 public void onSystemAccountsChanged() {}
381 }); 390 });
382 } 391 }
383 } 392 }
384 393
385 private void showConfirmSigninPagePreviousAccountCheck() { 394 private void showConfirmSigninPagePreviousAccountCheck() {
386 String accountName = getSelectedAccountName(); 395 String accountName = getSelectedAccountName();
387 ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncL astAccountName(), 396 ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncL astAccountName(),
388 accountName, ImportSyncType.PREVIOUS_DATA_FOUND, 397 accountName, ImportSyncType.PREVIOUS_DATA_FOUND,
389 mDelegate.getActivity().getFragmentManager(), 398 mDelegate.getFragmentManager(),
390 getContext(), new ConfirmImportSyncDataDialog.Listener() { 399 getContext(), new ConfirmImportSyncDataDialog.Listener() {
391 @Override 400 @Override
392 public void onConfirm(boolean wipeData) { 401 public void onConfirm(boolean wipeData) {
393 SigninManager.wipeSyncUserDataIfRequired(wipeData) 402 SigninManager.wipeSyncUserDataIfRequired(wipeData)
394 .then(new Callback<Void>() { 403 .then(new Callback<Void>() {
395 @Override 404 @Override
396 public void onResult(Void v) { 405 public void onResult(Void v) {
397 showConfirmSigninPage(); 406 showConfirmSigninPage();
398 } 407 }
399 }); 408 });
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 * @return Whether the view is in "no choice, just a confirmation" forced-ac count mode. 546 * @return Whether the view is in "no choice, just a confirmation" forced-ac count mode.
538 */ 547 */
539 public boolean isInForcedAccountMode() { 548 public boolean isInForcedAccountMode() {
540 return mForcedAccountName != null; 549 return mForcedAccountName != null;
541 } 550 }
542 551
543 private String getSelectedAccountName() { 552 private String getSelectedAccountName() {
544 return mAccountNames.get(mSigninChooseView.getSelectedAccountPosition()) ; 553 return mAccountNames.get(mSigninChooseView.getSelectedAccountPosition()) ;
545 } 554 }
546 } 555 }
OLDNEW
« 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