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.gsa; | 5 package org.chromium.chrome.browser.gsa; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 */ | 80 */ |
81 public void setGsaAccount(String gsaAccount) { | 81 public void setGsaAccount(String gsaAccount) { |
82 mGsaAccount = gsaAccount; | 82 mGsaAccount = gsaAccount; |
83 } | 83 } |
84 | 84 |
85 /** | 85 /** |
86 * @return Whether GSA and Chrome are logged in with the same account. The s
ituation where | 86 * @return Whether GSA and Chrome are logged in with the same account. The s
ituation where |
87 * both are logged out is not considered a match. | 87 * both are logged out is not considered a match. |
88 */ | 88 */ |
89 public boolean doesGsaAccountMatchChrome() { | 89 public boolean doesGsaAccountMatchChrome() { |
90 Account chromeUser = ChromeSigninController.get(mContext).getSignedInUse
r(); | 90 Account chromeUser = ChromeSigninController.get().getSignedInUser(); |
91 return chromeUser != null && !TextUtils.isEmpty(mGsaAccount) && TextUtil
s.equals( | 91 return chromeUser != null && !TextUtils.isEmpty(mGsaAccount) && TextUtil
s.equals( |
92 chromeUser.name, mGsaAccount); | 92 chromeUser.name, mGsaAccount); |
93 } | 93 } |
94 | 94 |
95 /** | 95 /** |
96 * @return The current GSA account. May return null if GSA hasn't replied ye
t. | 96 * @return The current GSA account. May return null if GSA hasn't replied ye
t. |
97 */ | 97 */ |
98 public String getGsaAccount() { | 98 public String getGsaAccount() { |
99 return mGsaAccount; | 99 return mGsaAccount; |
100 } | 100 } |
(...skipping 25 matching lines...) Expand all Loading... |
126 * Check whether the given package meets min requirements for using full doc
ument mode. | 126 * Check whether the given package meets min requirements for using full doc
ument mode. |
127 * @param packageName The package name we are inquiring about. | 127 * @param packageName The package name we are inquiring about. |
128 * @param minVersion The minimum version for the package to be. | 128 * @param minVersion The minimum version for the package to be. |
129 * @return Whether the package exists on the device and its version is highe
r than the minimum | 129 * @return Whether the package exists on the device and its version is highe
r than the minimum |
130 * required version. | 130 * required version. |
131 */ | 131 */ |
132 private boolean isPackageAboveVersion(String packageName, int minVersion) { | 132 private boolean isPackageAboveVersion(String packageName, int minVersion) { |
133 return PackageUtils.getPackageVersion(mContext, packageName) >= minVersi
on; | 133 return PackageUtils.getPackageVersion(mContext, packageName) >= minVersi
on; |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |