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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAckedReceiver.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 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
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.firstrun; 5 package org.chromium.chrome.browser.firstrun;
6 6
7 import android.content.BroadcastReceiver; 7 import android.content.BroadcastReceiver;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.SharedPreferences; 10 import android.content.SharedPreferences;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * @param context Context for the app. 49 * @param context Context for the app.
50 * @return Whether or not the the ToS has been seen. 50 * @return Whether or not the the ToS has been seen.
51 */ 51 */
52 public static boolean checkAnyUserHasSeenToS(Context context) { 52 public static boolean checkAnyUserHasSeenToS(Context context) {
53 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return false; 53 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return false;
54 54
55 Set<String> toSAckedAccounts = 55 Set<String> toSAckedAccounts =
56 ContextUtils.getAppSharedPreferences().getStringSet( 56 ContextUtils.getAppSharedPreferences().getStringSet(
57 TOS_ACKED_ACCOUNTS, null); 57 TOS_ACKED_ACCOUNTS, null);
58 if (toSAckedAccounts == null || toSAckedAccounts.isEmpty()) return false ; 58 if (toSAckedAccounts == null || toSAckedAccounts.isEmpty()) return false ;
59 AccountManagerHelper accountHelper = AccountManagerHelper.get(context); 59 AccountManagerHelper accountHelper = AccountManagerHelper.get();
60 List<String> accountNames = accountHelper.getGoogleAccountNames(); 60 List<String> accountNames = accountHelper.getGoogleAccountNames();
61 if (accountNames.isEmpty()) return false; 61 if (accountNames.isEmpty()) return false;
62 for (int k = 0; k < accountNames.size(); k++) { 62 for (int k = 0; k < accountNames.size(); k++) {
63 if (toSAckedAccounts.contains(accountNames.get(k))) return true; 63 if (toSAckedAccounts.contains(accountNames.get(k))) return true;
64 } 64 }
65 return false; 65 return false;
66 } 66 }
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698