OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.signin; |
| 6 |
| 7 import android.accounts.Account; |
| 8 import android.app.Activity; |
| 9 import android.content.Intent; |
| 10 import android.net.Uri; |
| 11 import android.os.Bundle; |
| 12 |
| 13 import org.chromium.chrome.browser.IntentHandler; |
| 14 import org.chromium.chrome.browser.UrlConstants; |
| 15 import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
| 16 import org.chromium.chrome.browser.preferences.Preferences; |
| 17 import org.chromium.chrome.browser.signin.AccountManagementScreenHelper.AccountM
anagementFragmentDelegate; |
| 18 import org.chromium.chrome.browser.sync.ui.SyncCustomizationFragment; |
| 19 |
| 20 /** |
| 21 * Implementation of the account management fragment delegate. |
| 22 * TODO(aruslan): delete this class once all of its dependencies are upstream. |
| 23 */ |
| 24 public class AccountManagementFragmentDelegateImpl implements AccountManagementF
ragmentDelegate { |
| 25 /** |
| 26 * Registers the account management fragment delegate implementation. |
| 27 */ |
| 28 public static void registerAccountManagementFragmentDelegate() { |
| 29 AccountManagementScreenHelper.setDelegate(new AccountManagementFragmentD
elegateImpl()); |
| 30 } |
| 31 |
| 32 @Override |
| 33 public void openIncognitoTab(Activity activity) { |
| 34 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse( |
| 35 IntentHandler.GOOGLECHROME_NAVIGATE_PREFIX + UrlConstants.NTP_UR
L)); |
| 36 intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true); |
| 37 intent.setPackage(activity.getApplicationContext().getPackageName()); |
| 38 intent.setClassName(activity.getApplicationContext().getPackageName(), |
| 39 ChromeLauncherActivity.class.getName()); |
| 40 |
| 41 intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |
| 42 | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TAS
K |
| 43 | Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| 44 IntentHandler.startActivityForTrustedIntent(intent, activity); |
| 45 } |
| 46 |
| 47 @Override |
| 48 public void openSignOutDialog(Activity activity) { |
| 49 SigninManager.get(activity).signOut(activity, null); |
| 50 } |
| 51 |
| 52 @Override |
| 53 public void openSyncCustomizationFragment(final Preferences activity, final
Account account) { |
| 54 Bundle args = new Bundle(); |
| 55 args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name)
; |
| 56 activity.startFragment(SyncCustomizationFragment.class.getName(), args); |
| 57 } |
| 58 } |
OLD | NEW |