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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeader.java

Issue 2644513005: Suppress deprecation warning for LOC_PROV_ALLOWED (Closed)
Patch Set: Suppress deprecation warning for LOC_PROV_ALLOWED Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.omnibox.geo; 5 package org.chromium.chrome.browser.omnibox.geo;
6 6
7 import android.Manifest; 7 import android.Manifest;
8 import android.content.pm.PackageManager; 8 import android.content.pm.PackageManager;
9 import android.location.Location; 9 import android.location.Location;
10 import android.location.LocationManager; 10 import android.location.LocationManager;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 return locationPermission; 394 return locationPermission;
395 } 395 }
396 396
397 /** Records a data point for the Geolocation.HeaderSentOrNot histogram. */ 397 /** Records a data point for the Geolocation.HeaderSentOrNot histogram. */
398 private static void recordHistogram(int result) { 398 private static void recordHistogram(int result) {
399 RecordHistogram.recordEnumeratedHistogram("Geolocation.HeaderSentOrNot", result, UMA_MAX); 399 RecordHistogram.recordEnumeratedHistogram("Geolocation.HeaderSentOrNot", result, UMA_MAX);
400 } 400 }
401 401
402 /** Returns the location source. */ 402 /** Returns the location source. */
403 @LocationSource 403 @LocationSource
404 // We should replace our usage of LOCATION_PROVIDERS_ALLOWED when the min AP I is 19.
405 @SuppressWarnings("deprecation")
404 private static int getLocationSource() { 406 private static int getLocationSource() {
405 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 407 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
406 int locationMode; 408 int locationMode;
407 try { 409 try {
408 locationMode = Settings.Secure.getInt( 410 locationMode = Settings.Secure.getInt(
409 ContextUtils.getApplicationContext().getContentResolver( ), 411 ContextUtils.getApplicationContext().getContentResolver( ),
410 Settings.Secure.LOCATION_MODE); 412 Settings.Secure.LOCATION_MODE);
411 } catch (Settings.SettingNotFoundException e) { 413 } catch (Settings.SettingNotFoundException e) {
412 Log.e(TAG, "Error getting the LOCATION_MODE"); 414 Log.e(TAG, "Error getting the LOCATION_MODE");
413 return LOCATION_SOURCE_MASTER_OFF; 415 return LOCATION_SOURCE_MASTER_OFF;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 assert false : "Unexpected locationSource: " + locationSource; 648 assert false : "Unexpected locationSource: " + locationSource;
647 return; 649 return;
648 } 650 }
649 long durationSeconds = durationMillis / 1000; 651 long durationSeconds = durationMillis / 1000;
650 int duration = durationSeconds >= (long) Integer.MAX_VALUE ? Integer.MAX _VALUE 652 int duration = durationSeconds >= (long) Integer.MAX_VALUE ? Integer.MAX _VALUE
651 : (int) durat ionSeconds; 653 : (int) durat ionSeconds;
652 RecordHistogram.recordCustomCountHistogram( 654 RecordHistogram.recordCustomCountHistogram(
653 name, duration, 1, LOCATION_AGE_HISTOGRAM_MAX_SECONDS, 50); 655 name, duration, 1, LOCATION_AGE_HISTOGRAM_MAX_SECONDS, 50);
654 } 656 }
655 } 657 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698