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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java

Issue 2367373003: [Android] Allow setting recently visited search engines as default search engine (Closed)
Patch Set: Update based on Peter and Dan's comments. Created 4 years 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
OLDNEW
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
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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); 1136 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( );
1137 private native boolean nativeIsMetricsReportingEnabled(); 1137 private native boolean nativeIsMetricsReportingEnabled();
1138 private native void nativeSetMetricsReportingEnabled(boolean enabled); 1138 private native void nativeSetMetricsReportingEnabled(boolean enabled);
1139 private native boolean nativeIsMetricsReportingManaged(); 1139 private native boolean nativeIsMetricsReportingManaged();
1140 private native void nativeSetClickedUpdateMenuItem(boolean clicked); 1140 private native void nativeSetClickedUpdateMenuItem(boolean clicked);
1141 private native boolean nativeGetClickedUpdateMenuItem(); 1141 private native boolean nativeGetClickedUpdateMenuItem();
1142 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion); 1142 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion);
1143 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); 1143 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem();
1144 private native void nativeSetSupervisedUserId(String supervisedUserId); 1144 private native void nativeSetSupervisedUserId(String supervisedUserId);
1145 } 1145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698