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.firstrun; |
| 6 |
| 7 import android.app.Fragment; |
| 8 import android.content.Context; |
| 9 import android.text.TextUtils; |
| 10 |
| 11 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
| 12 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager
; |
| 13 import org.chromium.chrome.browser.signin.AccountAdder; |
| 14 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 15 import org.chromium.sync.signin.AccountManagerHelper; |
| 16 |
| 17 import java.util.List; |
| 18 |
| 19 /** |
| 20 * Provides preferences glue for FirstRunActivity. |
| 21 */ |
| 22 public class FirstRunGlueImpl implements FirstRunGlue { |
| 23 @Override |
| 24 public boolean didAcceptTermsOfService(Context appContext) { |
| 25 return ToSAckedReceiver.checkAnyUserHasSeenToS(appContext) |
| 26 || PrefServiceBridge.getInstance().isFirstRunEulaAccepted(); |
| 27 } |
| 28 |
| 29 @Override |
| 30 public boolean isNeverUploadCrashDump(Context appContext) { |
| 31 return PrivacyPreferencesManager.getInstance(appContext).isNeverUploadCr
ashDump(); |
| 32 } |
| 33 |
| 34 @Override |
| 35 public void acceptTermsOfService(Context appContext, boolean allowCrashUploa
d) { |
| 36 PrivacyPreferencesManager.getInstance(appContext) |
| 37 .initCrashUploadPreference(allowCrashUpload); |
| 38 PrefServiceBridge.getInstance().setEulaAccepted(); |
| 39 } |
| 40 |
| 41 @Override |
| 42 public boolean isDocumentModeEligible(Context appContext) { |
| 43 return FeatureUtilities.isDocumentModeEligible(appContext); |
| 44 } |
| 45 |
| 46 @Override |
| 47 public boolean isDefaultAccountName(Context appContext, String accountName)
{ |
| 48 List<String> accountNames = AccountManagerHelper.get(appContext).getGoog
leAccountNames(); |
| 49 return accountNames != null |
| 50 && accountNames.size() > 0 |
| 51 && TextUtils.equals(accountNames.get(0), accountName); |
| 52 } |
| 53 |
| 54 @Override |
| 55 public void openAccountAdder(Fragment fragment) { |
| 56 AccountAdder.getInstance().addAccount(fragment, AccountAdder.ADD_ACCOUNT
_RESULT); |
| 57 } |
| 58 } |
OLD | NEW |