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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java

Issue 2946803002: Do not show any search engine promos if disabled by policy. (Closed)
Patch Set: Created 3 years, 6 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 | « chrome/android/BUILD.gn ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.locale; 5 package org.chromium.chrome.browser.locale;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.SharedPreferences; 10 import android.content.SharedPreferences;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 public void run() { 237 public void run() {
238 handleSearchEnginePromoWithTemplateUrlsLoaded(activity, onSearch EngineFinalized); 238 handleSearchEnginePromoWithTemplateUrlsLoaded(activity, onSearch EngineFinalized);
239 } 239 }
240 }); 240 });
241 } 241 }
242 242
243 private void handleSearchEnginePromoWithTemplateUrlsLoaded( 243 private void handleSearchEnginePromoWithTemplateUrlsLoaded(
244 final Activity activity, final @Nullable Callback<Boolean> onSearchE ngineFinalized) { 244 final Activity activity, final @Nullable Callback<Boolean> onSearchE ngineFinalized) {
245 assert TemplateUrlService.getInstance().isLoaded(); 245 assert TemplateUrlService.getInstance().isLoaded();
246 246
247 if (TemplateUrlService.getInstance().isDefaultSearchManaged()) {
248 if (onSearchEngineFinalized != null) onSearchEngineFinalized.onResul t(true);
249 return;
250 }
251
247 final int shouldShow = getSearchEnginePromoShowType(); 252 final int shouldShow = getSearchEnginePromoShowType();
248 Callable<PromoDialog> dialogCreator; 253 Callable<PromoDialog> dialogCreator;
249 switch (shouldShow) { 254 switch (shouldShow) {
250 case SEARCH_ENGINE_PROMO_DONT_SHOW: 255 case SEARCH_ENGINE_PROMO_DONT_SHOW:
251 if (onSearchEngineFinalized != null) onSearchEngineFinalized.onR esult(true); 256 if (onSearchEngineFinalized != null) onSearchEngineFinalized.onR esult(true);
252 return; 257 return;
253 case SEARCH_ENGINE_PROMO_SHOW_SOGOU: 258 case SEARCH_ENGINE_PROMO_SHOW_SOGOU:
254 dialogCreator = new Callable<PromoDialog>() { 259 dialogCreator = new Callable<PromoDialog>() {
255 @Override 260 @Override
256 public PromoDialog call() throws Exception { 261 public PromoDialog call() throws Exception {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 * Record any locale based metrics related with search. Recorded per search. 468 * Record any locale based metrics related with search. Recorded per search.
464 * @param isFromSearchWidget Whether the search was performed from the searc h widget. 469 * @param isFromSearchWidget Whether the search was performed from the searc h widget.
465 * @param url Url for the search made. 470 * @param url Url for the search made.
466 * @param transition The transition type for the navigation. 471 * @param transition The transition type for the navigation.
467 */ 472 */
468 public void recordLocaleBasedSearchMetrics( 473 public void recordLocaleBasedSearchMetrics(
469 boolean isFromSearchWidget, String url, @PageTransition int transiti on) {} 474 boolean isFromSearchWidget, String url, @PageTransition int transiti on) {}
470 475
471 private static native int nativeGetEngineType(String url); 476 private static native int nativeGetEngineType(String url);
472 } 477 }
OLDNEW
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698