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.preferences; | 5 package org.chromium.chrome.browser.preferences; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (position == -1) { | 353 if (position == -1) { |
354 return ContentSetting.BLOCK; | 354 return ContentSetting.BLOCK; |
355 } | 355 } |
356 | 356 |
357 String url = TemplateUrlService.getInstance().getSearchEngineUrlFromTemp
lateUrl( | 357 String url = TemplateUrlService.getInstance().getSearchEngineUrlFromTemp
lateUrl( |
358 toKeyword(position)); | 358 toKeyword(position)); |
359 GeolocationInfo locationSettings = new GeolocationInfo(url, null, false)
; | 359 GeolocationInfo locationSettings = new GeolocationInfo(url, null, false)
; |
360 ContentSetting locationPermission = locationSettings.getContentSetting()
; | 360 ContentSetting locationPermission = locationSettings.getContentSetting()
; |
361 if (locationPermission == ContentSetting.ASK) { | 361 if (locationPermission == ContentSetting.ASK) { |
362 // Handle the case where the geoHeader being sent when no permission
has been specified. | 362 // Handle the case where the geoHeader being sent when no permission
has been specified. |
363 if (checkGeoHeader && GeolocationHeader.isGeoHeaderEnabledForUrl( | 363 if (checkGeoHeader && GeolocationHeader.isGeoHeaderEnabledForUrl(url
, false)) { |
364 mContext, url, false)) { | |
365 locationPermission = ContentSetting.ALLOW; | 364 locationPermission = ContentSetting.ALLOW; |
366 } | 365 } |
367 } | 366 } |
368 return locationPermission; | 367 return locationPermission; |
369 } | 368 } |
370 | 369 |
371 private boolean locationEnabled(int position, boolean checkGeoHeader) { | 370 private boolean locationEnabled(int position, boolean checkGeoHeader) { |
372 return getLocationPermissionType(position, checkGeoHeader) == ContentSet
ting.ALLOW; | 371 return getLocationPermissionType(position, checkGeoHeader) == ContentSet
ting.ALLOW; |
373 } | 372 } |
374 | 373 |
375 private int computeStartIndexForRecentSearchEngines() { | 374 private int computeStartIndexForRecentSearchEngines() { |
376 return mPrepopulatedSearchEngines.size() + 1; | 375 return mPrepopulatedSearchEngines.size() + 1; |
377 } | 376 } |
378 } | 377 } |
OLD | NEW |