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

Issue 1354763003: [Contextual Search] Trigger the translation one-box. (Closed)

Created:
5 years, 3 months ago by Donn Denman
Modified:
5 years, 1 month ago
CC:
chromium-reviews, Theresa, joshuacooper_google.com, shmichael_google.com
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Contextual Search] Trigger the translation one-box. Adds support for triggering a Translate one-box on the SERP in response to a tap gesture. * Adds client recognition of the "lang" parameter returned in the Search Term Resolution response. * Updates unit tests to check for language. * Adds a method to get the user's "target" languages. * Adds a check to see if the "source" and "target" languages are different enough to require translation. * Adds parameters to the Search request when translation is needed to trigger the Translate one-box. These parameters still need to be revised to match an evolving server-side API. * Add a utility to UiUtils that produces a set of locales known by the user by inspecting the Android input methods. * Put this functionality behind a Finch flag. BUG=413717 Committed: https://crrev.com/9959a95fc4fedd724decdd1a5b938803c4990a7d Cr-Commit-Position: refs/heads/master@{#358101}

Patch Set 1 #

Total comments: 22

Patch Set 2 : Added a method to get all locales by checking IME. Put translation behind a flag. #

Total comments: 9

Patch Set 3 : Updated UiUtils to address Ted's comments. #

Total comments: 4

Patch Set 4 : Addressed Teds comments: Changed to use LinkedHashSet to ensure unique and ordered results. #

Total comments: 2

Patch Set 5 : Return a Set instead of a List from the UiUtil. #

Patch Set 6 : Added languages from accept-headers. #

Patch Set 7 : Disable for non-English users, for now. #

Total comments: 26

Patch Set 8 : Addressed Pedros recent comments, including changing the caching of the target language. #

Total comments: 4

Patch Set 9 : Caching getTargetLanguages, as suggested by Pedro in his last review. #

Patch Set 10 : Fix unit tests. #

Total comments: 2

Patch Set 11 : Rebase #

Patch Set 12 : Rebase, and remove ContextualSearchPanelDelegate.java (already removed from repo). #

Patch Set 13 : Add flag settings to new instrumentation tests. #

Patch Set 14 : Rebased with Pedro's new test infrastructure, updated these instrumentation tests to use that. #

Total comments: 6

Patch Set 15 : Updated comment about test infrastructure needing to be updated when shifting to new API. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+560 lines, -106 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +17 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java View 1 2 3 4 5 6 7 8 9 chunks +99 lines, -4 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchNetworkCommunicator.java View 1 1 chunk +2 lines, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +42 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRequest.java View 1 2 3 4 5 6 7 4 chunks +94 lines, -10 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 8 chunks +19 lines, -11 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +54 lines, -13 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_delegate.h View 1 2 3 4 5 6 7 5 chunks +18 lines, -16 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_delegate.cc View 1 2 3 4 5 6 7 8 6 chunks +34 lines, -7 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc View 1 2 3 4 5 6 7 8 9 6 chunks +39 lines, -21 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_manager.h View 1 2 3 4 5 1 chunk +10 lines, -9 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_manager.cc View 1 2 3 4 5 2 chunks +33 lines, -14 lines 0 comments Download
A chrome/browser/android/contextualsearch/resolved_search_term.h View 1 1 chunk +41 lines, -0 lines 0 comments Download
A chrome/browser/android/contextualsearch/resolved_search_term.cc View 1 1 chunk +26 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/test/data/android/contextualsearch/tap_test.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M ui/android/java/src/org/chromium/ui/UiUtils.java View 1 2 3 4 2 chunks +28 lines, -0 lines 0 comments Download

Messages

Total messages: 55 (21 generated)
Donn Denman
Pedro, this isn't finished yet because we still have some issues with the Translate one-box ...
5 years, 3 months ago (2015-09-18 18:15:48 UTC) #2
pedro (no code reviews)
Hey Donn, sorry for the delay. Here are my first round of comments. Overall, things ...
5 years, 3 months ago (2015-09-23 18:33:55 UTC) #3
Donn Denman
Ted, PTAL just at UiUtils. Pedro, thanks for the review! PTAL. https://chromiumcodereview.appspot.com/1354763003/diff/1/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java File chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java (right): ...
5 years, 2 months ago (2015-10-09 22:08:23 UTC) #5
Ted C
https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java File ui/android/java/src/org/chromium/ui/UiUtils.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java#newcode149 ui/android/java/src/org/chromium/ui/UiUtils.java:149: List<String> result = new ArrayList<String>(); I'd recommend returning a ...
5 years, 2 months ago (2015-10-09 22:50:30 UTC) #6
Donn Denman
Ted, thanks for the review! Soon I'll remember TextUtils.isEmpty. PTAL. https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java File ui/android/java/src/org/chromium/ui/UiUtils.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java#newcode149 ...
5 years, 2 months ago (2015-10-09 23:51:38 UTC) #7
Ted C
lgtm https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java File ui/android/java/src/org/chromium/ui/UiUtils.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/20001/ui/android/java/src/org/chromium/ui/UiUtils.java#newcode149 ui/android/java/src/org/chromium/ui/UiUtils.java:149: List<String> result = new ArrayList<String>(); On 2015/10/09 23:51:38, ...
5 years, 2 months ago (2015-10-10 00:05:47 UTC) #8
Donn Denman
Ted, how does this look now? Thanks for educating me on the Linked Hash collections! ...
5 years, 2 months ago (2015-10-12 18:43:52 UTC) #9
Ted C
lgtm https://chromiumcodereview.appspot.com/1354763003/diff/60001/ui/android/java/src/org/chromium/ui/UiUtils.java File ui/android/java/src/org/chromium/ui/UiUtils.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/60001/ui/android/java/src/org/chromium/ui/UiUtils.java#newcode164 ui/android/java/src/org/chromium/ui/UiUtils.java:164: return new ArrayList<String>(locales); I'd just return the Set ...
5 years, 2 months ago (2015-10-13 01:15:13 UTC) #10
Donn Denman
Pedro, PTAL. Thanks Ted! https://chromiumcodereview.appspot.com/1354763003/diff/60001/ui/android/java/src/org/chromium/ui/UiUtils.java File ui/android/java/src/org/chromium/ui/UiUtils.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/60001/ui/android/java/src/org/chromium/ui/UiUtils.java#newcode164 ui/android/java/src/org/chromium/ui/UiUtils.java:164: return new ArrayList<String>(locales); On 2015/10/13 ...
5 years, 2 months ago (2015-10-13 16:54:32 UTC) #11
Donn Denman
Pedro, PTAL. I think this is in good shape to land for English users since ...
5 years, 2 months ago (2015-10-22 19:56:45 UTC) #14
pedro (no code reviews)
https://codereview.chromium.org/1354763003/diff/1/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java File chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java (right): https://codereview.chromium.org/1354763003/diff/1/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java#newcode715 chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java:715: boolean needsTranslation = false; On 2015/10/09 22:08:23, Donn Denman ...
5 years, 2 months ago (2015-10-23 08:50:36 UTC) #15
Donn Denman
Pedro PTAL. Thanks for the review! https://chromiumcodereview.appspot.com/1354763003/diff/120001/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/120001/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java#newcode923 chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java:923: public Context getContext() ...
5 years, 1 month ago (2015-10-28 22:17:15 UTC) #16
pedro (no code reviews)
lgtm I still think caching the result of getTargetLanguages() is a good idea. What about ...
5 years, 1 month ago (2015-10-30 00:58:43 UTC) #17
Donn Denman
Thank you Pedro! https://codereview.chromium.org/1354763003/diff/120001/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java File chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java (right): https://codereview.chromium.org/1354763003/diff/120001/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java#newcode750 chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java:750: List<String> targetLanguages = getTargetLanguages(); On 2015/10/30 ...
5 years, 1 month ago (2015-11-03 01:06:26 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/160001
5 years, 1 month ago (2015-11-03 17:41:01 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/141407)
5 years, 1 month ago (2015-11-03 18:02:16 UTC) #23
Donn Denman
Pedro, PTAL: needed to fix the unit tests. I'd verified the instrumentation tests worked, but ...
5 years, 1 month ago (2015-11-03 18:49:50 UTC) #24
pedro (no code reviews)
Thanks for the changes Donn. I have just a single nit, otherwise this CL looks ...
5 years, 1 month ago (2015-11-03 19:36:19 UTC) #25
Donn Denman
Thanks Pedro! https://codereview.chromium.org/1354763003/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java File chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java (right): https://codereview.chromium.org/1354763003/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java#newcode125 chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java:125: private List<String> mTargetLanguages; On 2015/11/03 19:36:19, pedrosimonetti ...
5 years, 1 month ago (2015-11-03 21:36:37 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/180001
5 years, 1 month ago (2015-11-03 21:38:23 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/83487) linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, ...
5 years, 1 month ago (2015-11-03 21:42:56 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/200001
5 years, 1 month ago (2015-11-03 22:43:37 UTC) #34
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/118422) mac_chromium_gn_rel on tryserver.chromium.mac (JOB_FAILED, ...
5 years, 1 month ago (2015-11-03 22:48:31 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/220001
5 years, 1 month ago (2015-11-03 23:57:38 UTC) #39
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_rel_ng/builds/90987)
5 years, 1 month ago (2015-11-04 02:55:37 UTC) #41
Donn Denman
On 2015/11/04 02:55:37, commit-bot: I haz the power wrote: > Try jobs failed on following ...
5 years, 1 month ago (2015-11-04 23:08:12 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/240001
5 years, 1 month ago (2015-11-04 23:20:56 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/119039) mac_chromium_gn_rel on tryserver.chromium.mac (JOB_FAILED, ...
5 years, 1 month ago (2015-11-04 23:23:50 UTC) #47
Donn Denman
Pedro, PTAL. Thanks!
5 years, 1 month ago (2015-11-05 01:14:29 UTC) #48
pedro (no code reviews)
lgtm Just a single nit to add a comment. Change is looking good! https://codereview.chromium.org/1354763003/diff/260001/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java File ...
5 years, 1 month ago (2015-11-05 02:09:59 UTC) #49
Donn Denman
Thanks Pedro! https://chromiumcodereview.appspot.com/1354763003/diff/260001/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java File chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java (right): https://chromiumcodereview.appspot.com/1354763003/diff/260001/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java#newcode395 chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java:395: * @return Whether onShow() was ever called ...
5 years, 1 month ago (2015-11-05 17:51:09 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1354763003/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1354763003/280001
5 years, 1 month ago (2015-11-05 17:52:03 UTC) #53
commit-bot: I haz the power
Committed patchset #15 (id:280001)
5 years, 1 month ago (2015-11-05 19:08:40 UTC) #54
commit-bot: I haz the power
5 years, 1 month ago (2015-11-05 19:09:53 UTC) #55
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/9959a95fc4fedd724decdd1a5b938803c4990a7d
Cr-Commit-Position: refs/heads/master@{#358101}

Powered by Google App Engine
This is Rietveld 408576698