OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.util.Log; | 9 import android.util.Log; |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 /** | 169 /** |
170 * Add a permission entry for Location for the default search engine. | 170 * Add a permission entry for Location for the default search engine. |
171 * @param allowed Whether to create an Allowed permission or a Denied permis
sion. | 171 * @param allowed Whether to create an Allowed permission or a Denied permis
sion. |
172 * @param context The current context to use. | 172 * @param context The current context to use. |
173 */ | 173 */ |
174 public static void maybeCreatePermissionForDefaultSearchEngine( | 174 public static void maybeCreatePermissionForDefaultSearchEngine( |
175 boolean allowed, Context context) { | 175 boolean allowed, Context context) { |
176 TemplateUrlService templateUrlService = TemplateUrlService.getInstance()
; | 176 TemplateUrlService templateUrlService = TemplateUrlService.getInstance()
; |
177 String url = templateUrlService.getSearchEngineUrlFromTemplateUrl( | 177 String url = templateUrlService.getSearchEngineUrlFromTemplateUrl( |
178 templateUrlService.getDefaultSearchEngineIndex()); | 178 templateUrlService.getDefaultSearchEngineTemplateUrl().getKeywor
d()); |
179 if (allowed && !url.startsWith("https:")) return; | 179 if (allowed && !url.startsWith("https:")) return; |
180 GeolocationInfo locationSettings = new GeolocationInfo(url, null, false)
; | 180 GeolocationInfo locationSettings = new GeolocationInfo(url, null, false)
; |
181 ContentSetting locationPermission = locationSettings.getContentSetting()
; | 181 ContentSetting locationPermission = locationSettings.getContentSetting()
; |
182 if (locationPermission == null || locationPermission == ContentSetting.A
SK) { | 182 if (locationPermission == null || locationPermission == ContentSetting.A
SK) { |
183 WebsitePreferenceBridge.nativeSetGeolocationSettingForOrigin(url, ur
l, | 183 WebsitePreferenceBridge.nativeSetGeolocationSettingForOrigin(url, ur
l, |
184 allowed ? ContentSetting.ALLOW.toInt() : ContentSetting.BLOC
K.toInt(), false); | 184 allowed ? ContentSetting.ALLOW.toInt() : ContentSetting.BLOC
K.toInt(), false); |
185 SharedPreferences sharedPreferences = | 185 SharedPreferences sharedPreferences = |
186 ContextUtils.getAppSharedPreferences(); | 186 ContextUtils.getAppSharedPreferences(); |
187 sharedPreferences.edit().putBoolean(LOCATION_AUTO_ALLOWED, true).app
ly(); | 187 sharedPreferences.edit().putBoolean(LOCATION_AUTO_ALLOWED, true).app
ly(); |
188 } | 188 } |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL(
); | 1162 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL(
); |
1163 private native boolean nativeIsMetricsReportingEnabled(); | 1163 private native boolean nativeIsMetricsReportingEnabled(); |
1164 private native void nativeSetMetricsReportingEnabled(boolean enabled); | 1164 private native void nativeSetMetricsReportingEnabled(boolean enabled); |
1165 private native boolean nativeIsMetricsReportingManaged(); | 1165 private native boolean nativeIsMetricsReportingManaged(); |
1166 private native void nativeSetClickedUpdateMenuItem(boolean clicked); | 1166 private native void nativeSetClickedUpdateMenuItem(boolean clicked); |
1167 private native boolean nativeGetClickedUpdateMenuItem(); | 1167 private native boolean nativeGetClickedUpdateMenuItem(); |
1168 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v
ersion); | 1168 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v
ersion); |
1169 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); | 1169 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); |
1170 private native void nativeSetSupervisedUserId(String supervisedUserId); | 1170 private native void nativeSetSupervisedUserId(String supervisedUserId); |
1171 } | 1171 } |
OLD | NEW |