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

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)

Created:
4 years, 3 months ago by Ian Wen
Modified:
4 years, 2 months ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Enable Chrome to tweak search engines for some locales In some locales we might want to show some extra search engine options. This CL creates a JNI bridge, SpecialLocaleHandler, that will manage the changes we do to the TURL service, when the device is in special locale. BUG=638062 Committed: https://crrev.com/a27b1dfa7d0a8c7cb876d0bcd847555b9a1e87eb Cr-Commit-Position: refs/heads/master@{#420770}

Patch Set 1 #

Total comments: 26

Patch Set 2 : comments #

Total comments: 19

Patch Set 3 : change TemplateUrl#GetType() to type() #

Patch Set 4 : fix compile #

Total comments: 23

Patch Set 5 : pkasting's additional comments #

Total comments: 3

Patch Set 6 : compile #

Total comments: 6

Patch Set 7 : final nits #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+432 lines, -126 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java View 1 3 chunks +45 lines, -0 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/locale/SpecialLocaleHandler.java View 1 1 chunk +70 lines, -0 lines 0 comments Download
M chrome/android/java_sources.gni View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/BUILD.gn View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/android/chrome_jni_registrar.cc View 2 chunks +2 lines, -0 lines 0 comments Download
A + chrome/browser/android/locale/OWNERS View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/browser/android/locale/special_locale_handler.h View 1 2 3 4 5 6 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/browser/android/locale/special_locale_handler.cc View 1 2 1 chunk +120 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/omnibox/omnibox_api.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc View 1 2 3 4 5 1 chunk +7 lines, -5 lines 0 comments Download
M chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/search_engines/chrome_template_url_service_client.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/search_engines/template_url_service_sync_unittest.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/search_engines/template_url_service_unittest.cc View 1 2 3 4 6 chunks +15 lines, -18 lines 0 comments Download
M chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/omnibox/chrome_omnibox_client.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/search_engines/keyword_editor_controller.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/search_engines/template_url_table_model.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/location_bar/location_bar_view.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options/search_engine_manager_handler.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/settings/search_engines_handler.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/omnibox/browser/autocomplete_controller.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/omnibox/browser/keyword_provider.cc View 1 2 4 chunks +4 lines, -4 lines 0 comments Download
M components/omnibox/browser/search_provider.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M components/search_engines/default_search_pref_migration_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/search_engines/keyword_table.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/search_engines/search_host_to_urls_map.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M components/search_engines/template_url.h View 1 2 3 4 5 chunks +11 lines, -6 lines 0 comments Download
M components/search_engines/template_url.cc View 1 2 3 4 4 chunks +7 lines, -17 lines 0 comments Download
M components/search_engines/template_url_prepopulate_data.h View 1 2 3 4 5 6 1 chunk +12 lines, -2 lines 0 comments Download
M components/search_engines/template_url_prepopulate_data.cc View 1 2 3 4 5 6 4 chunks +27 lines, -16 lines 2 comments Download
M components/search_engines/template_url_service.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/search_engines/template_url_service.cc View 1 2 3 4 26 chunks +42 lines, -35 lines 0 comments Download

Messages

Total messages: 41 (22 generated)
Ian Wen
mariakhomenko@chromium.org: Please review changes in browser. pkasting@chromium.org: Please review changes in components/search_engine and browser/search_engine. Thank ...
4 years, 3 months ago (2016-09-16 21:51:02 UTC) #2
Maria
I think this change is missing tests. Mostly nits -- and I did not really ...
4 years, 3 months ago (2016-09-16 23:44:02 UTC) #3
Ian Wen
PTAL the 2nd patchset. I totally that there should be tests for special_locale* code. Maybe ...
4 years, 3 months ago (2016-09-19 17:37:55 UTC) #4
Peter Kasting
https://codereview.chromium.org/2347973002/diff/20001/components/search_engines/template_url.h File components/search_engines/template_url.h (right): https://codereview.chromium.org/2347973002/diff/20001/components/search_engines/template_url.h#newcode502 components/search_engines/template_url.h:502: // Installed only on this device. Should not be ...
4 years, 3 months ago (2016-09-19 21:06:24 UTC) #5
Ian Wen
All addressed. PTAL. :) https://chromiumcodereview.appspot.com/2347973002/diff/20001/components/search_engines/template_url.h File components/search_engines/template_url.h (right): https://chromiumcodereview.appspot.com/2347973002/diff/20001/components/search_engines/template_url.h#newcode502 components/search_engines/template_url.h:502: // Installed only on this ...
4 years, 3 months ago (2016-09-20 04:48:04 UTC) #6
Peter Kasting
https://chromiumcodereview.appspot.com/2347973002/diff/60001/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc File chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc (right): https://chromiumcodereview.appspot.com/2347973002/diff/60001/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc#newcode272 chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc:272: new TemplateURL::AssociatedExtensionInfo(extension->id())); Nit: While here, use MakeUnique(): auto info ...
4 years, 3 months ago (2016-09-21 21:45:08 UTC) #15
Ian Wen
Thanks for the comments. All addressed. PTAL :) https://codereview.chromium.org/2347973002/diff/60001/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc File chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc (right): https://codereview.chromium.org/2347973002/diff/60001/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc#newcode272 chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc:272: new ...
4 years, 3 months ago (2016-09-21 23:12:38 UTC) #18
Maria
lgtm https://codereview.chromium.org/2347973002/diff/80001/chrome/browser/android/locale/special_locale_handler.h File chrome/browser/android/locale/special_locale_handler.h (right): https://codereview.chromium.org/2347973002/diff/80001/chrome/browser/android/locale/special_locale_handler.h#newcode16 chrome/browser/android/locale/special_locale_handler.h:16: using std::vector; nit: I feel like it's really ...
4 years, 3 months ago (2016-09-22 17:17:55 UTC) #25
Peter Kasting
LGTM https://codereview.chromium.org/2347973002/diff/60001/components/search_engines/template_url.h File components/search_engines/template_url.h (right): https://codereview.chromium.org/2347973002/diff/60001/components/search_engines/template_url.h#newcode521 components/search_engines/template_url.h:521: TemplateURL(const TemplateURLData& data, Type type = NORMAL); On ...
4 years, 3 months ago (2016-09-23 01:28:36 UTC) #26
Ian Wen
dbeam@chromium.org: Please review changes in web ui. asargent@ Please review changes in extensions
4 years, 3 months ago (2016-09-23 07:56:30 UTC) #28
asargent_no_longer_on_chrome
chrome/browser/extensions/* lgtm
4 years, 3 months ago (2016-09-23 16:38:33 UTC) #29
Dan Beam
lgtm
4 years, 3 months ago (2016-09-23 21:51:04 UTC) #30
Ian Wen
https://codereview.chromium.org/2347973002/diff/80001/chrome/browser/android/locale/special_locale_handler.h File chrome/browser/android/locale/special_locale_handler.h (right): https://codereview.chromium.org/2347973002/diff/80001/chrome/browser/android/locale/special_locale_handler.h#newcode16 chrome/browser/android/locale/special_locale_handler.h:16: using std::vector; On 2016/09/23 01:28:36, Peter Kasting wrote: > ...
4 years, 3 months ago (2016-09-23 22:01:57 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2347973002/120001
4 years, 3 months ago (2016-09-23 22:02:43 UTC) #34
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 3 months ago (2016-09-23 23:08:47 UTC) #35
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/a27b1dfa7d0a8c7cb876d0bcd847555b9a1e87eb Cr-Commit-Position: refs/heads/master@{#420770}
4 years, 3 months ago (2016-09-23 23:11:27 UTC) #37
Alexander Yashkin
https://codereview.chromium.org/2347973002/diff/120001/components/search_engines/template_url_prepopulate_data.cc File components/search_engines/template_url_prepopulate_data.cc (right): https://codereview.chromium.org/2347973002/diff/120001/components/search_engines/template_url_prepopulate_data.cc#newcode1140 components/search_engines/template_url_prepopulate_data.cc:1140: return GetPrepopulationSetFromCountryID(country_id); Is it ok, that GetLocalPrepopulatedEngines returns list ...
4 years, 2 months ago (2016-10-21 06:34:41 UTC) #39
Peter Kasting
https://codereview.chromium.org/2347973002/diff/120001/components/search_engines/template_url_prepopulate_data.cc File components/search_engines/template_url_prepopulate_data.cc (right): https://codereview.chromium.org/2347973002/diff/120001/components/search_engines/template_url_prepopulate_data.cc#newcode1140 components/search_engines/template_url_prepopulate_data.cc:1140: return GetPrepopulationSetFromCountryID(country_id); On 2016/10/21 06:34:41, Alexander Yashkin wrote: > ...
4 years, 2 months ago (2016-10-21 06:44:42 UTC) #40
Alexander Yashkin
4 years, 2 months ago (2016-10-21 08:32:21 UTC) #41
Message was sent while issue was closed.
On 2016/10/21 at 06:44:42, pkasting wrote:
>
https://codereview.chromium.org/2347973002/diff/120001/components/search_engi...
> File components/search_engines/template_url_prepopulate_data.cc (right):
> 
>
https://codereview.chromium.org/2347973002/diff/120001/components/search_engi...
> components/search_engines/template_url_prepopulate_data.cc:1140: return
GetPrepopulationSetFromCountryID(country_id);
> On 2016/10/21 06:34:41, Alexander Yashkin wrote:
> > Is it ok, that GetLocalPrepopulatedEngines returns list of prepopulated
engines
> > for locale and do not take in consideration 
> > engines that were overriden from preference file like its done in
> > GetPrepopulatedEngines?
> 
> What do you mean "is it OK"?  This is a utility function, so the question is
what the overall system is doing, not just what this function is doing.  What
does the caller need to take into account?  What preferences are in question
here?  Or to step back: what problem are you seeing that needs solving?

I think I finally understand logic behind this code. 
I have no access to https://bugs.chromium.org/p/chromium/issues/detail?id=638062
so have to guess from code:

I was worried that two functions - GetPrepopulatedEngines and
GetLocalPrepopulatedEngines can return different sets of engines for same
country. 
GetPrepopulatedEngines uses content prefs::kSearchProviderOverrides and country
id, and GetLocalPrepopulatedEngines uses only country id.

I believe prefs::kSearchProviderOverrides is used to add some ability to
override search engines set and default search by branded Chrome distributives.
If I understand this commit correctly it adds ability to dynamically add/remove
search engines if locale is changed during browser work.

My worry was that default search engine already overriden by
prefs::kSearchProviderOverrides could again be overriden by locale change.
Yet, i see that SpecialLocaleHandler::OverrideDefaultSearchProvider already
checks and does nothing for non-google dsp.

So, it seems there is nothing to worry about.

Powered by Google App Engine
This is Rietveld 408576698