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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java

Issue 815343005: Clean up geolocation code now that it's all upstream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renamed IsSystemLocationEnabled -> IsLocationEnabled Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/shell/chrome_shell_google_location_settings_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
index 4d2b58b65bbabb7e806b20938a21537101587f58..69f89d37b0aa8b8eae7667d4cea5e8de5e09db8f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
@@ -16,12 +16,11 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.chrome.browser.ChromiumApplication;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-
/**
* Provides methods for querying Android system-wide location settings as well as Chrome's internal
* location setting.
+ *
+ * This class should be used only on the UI thread.
*/
public class LocationSettings {
@@ -42,6 +41,7 @@ public class LocationSettings {
*/
@SuppressFBWarnings("LI_LAZY_INIT_STATIC")
public static LocationSettings getInstance() {
+ ThreadUtils.assertOnUiThread();
if (sInstance == null) {
ChromiumApplication application =
(ChromiumApplication) ApplicationStatus.getApplicationContext();
@@ -55,19 +55,9 @@ public class LocationSettings {
*/
@CalledByNative
public static boolean areAllLocationSettingsEnabled() {
- try {
- return ThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>(){
- @Override
- public Boolean call() throws Exception {
- LocationSettings settings = LocationSettings.getInstance();
- return settings.isChromeLocationSettingEnabled()
- && settings.isSystemLocationSettingEnabled();
- }
- });
- } catch (ExecutionException e) {
- e.printStackTrace();
- return false;
- }
+ LocationSettings settings = LocationSettings.getInstance();
+ return settings.isChromeLocationSettingEnabled()
+ && settings.isSystemLocationSettingEnabled();
}
/**
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/shell/chrome_shell_google_location_settings_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698