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

Issue 2555513003: [Android] Sort custom search engines based on last visited time and display only top 3 most recentl… (Closed)

Created:
4 years ago by ltian
Modified:
4 years ago
Reviewers:
Ted C, Peter Kasting
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android] Sort custom search engines based on last visited time and display only top 5 most recently visited engines On Android, all visited custom search engines are shown in the same order provided by TemplateULService. New design wants to sort the custom search engines based on their last visited times and display only top 3 most recently visited engines within 2 days. Add logic in LoadTemplateURLs() to sort custom search engines based on the last_visited field and remove redundant engines if there are more than 3 engines return false for ShowInDefaultList() and visited within 2 days. BUG=348360 Committed: https://crrev.com/dffd7c39dddd7ee52ffde3b877a237b5b877a252 Cr-Commit-Position: refs/heads/master@{#439251}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Update based on Peter's comment #

Patch Set 3 : Change to only display top 3 most recently visted custom search engines within 2 days. #

Total comments: 2

Patch Set 4 : Update based on Peter's comment. #

Total comments: 14

Patch Set 5 : Add unittests for changes. #

Total comments: 7

Patch Set 6 : Update based on Ted's comments. #

Total comments: 3

Patch Set 7 : Update based on Peter's comments. #

Patch Set 8 : Fix the conflicts #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -25 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java View 1 2 3 4 5 6 3 chunks +16 lines, -0 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java View 1 2 3 4 5 6 7 1 chunk +81 lines, -0 lines 0 comments Download
M chrome/browser/search_engines/template_url_service_android.h View 1 2 3 4 5 2 chunks +11 lines, -1 line 0 comments Download
M chrome/browser/search_engines/template_url_service_android.cc View 1 2 3 4 5 2 chunks +73 lines, -11 lines 0 comments Download
M components/search_engines/template_url_service.h View 1 2 3 4 5 6 7 3 chunks +8 lines, -7 lines 0 comments Download
M components/search_engines/template_url_service.cc View 1 2 3 4 5 6 7 2 chunks +7 lines, -6 lines 0 comments Download

Messages

Total messages: 63 (35 generated)
ltian
Can you take a look of this CL? Thanks!
4 years ago (2016-12-05 22:02:59 UTC) #6
Peter Kasting
The comments I've left below are fairly sketchy. To implement them, you will need to ...
4 years ago (2016-12-06 06:24:55 UTC) #7
ltian
https://codereview.chromium.org/2555513003/diff/1/chrome/browser/search_engines/template_url_service_android.cc File chrome/browser/search_engines/template_url_service_android.cc (right): https://codereview.chromium.org/2555513003/diff/1/chrome/browser/search_engines/template_url_service_android.cc#newcode161 chrome/browser/search_engines/template_url_service_android.cc:161: std::sort(template_urls_.begin(), template_urls_.end(), comp); On 2016/12/06 06:24:55, Peter Kasting wrote: ...
4 years ago (2016-12-07 00:56:43 UTC) #12
Peter Kasting
Quick thoughts as I have to run: I think a larger change is needed here. ...
4 years ago (2016-12-07 22:02:01 UTC) #13
ltian
4 years ago (2016-12-08 04:17:55 UTC) #14
Peter Kasting
This needs tests. https://codereview.chromium.org/2555513003/diff/40001/chrome/browser/search_engines/template_url_service_android.cc File chrome/browser/search_engines/template_url_service_android.cc (right): https://codereview.chromium.org/2555513003/diff/40001/chrome/browser/search_engines/template_url_service_android.cc#newcode173 chrome/browser/search_engines/template_url_service_android.cc:173: } Functionally, this looks like it ...
4 years ago (2016-12-08 06:56:27 UTC) #15
ltian
https://codereview.chromium.org/2555513003/diff/40001/chrome/browser/search_engines/template_url_service_android.cc File chrome/browser/search_engines/template_url_service_android.cc (right): https://codereview.chromium.org/2555513003/diff/40001/chrome/browser/search_engines/template_url_service_android.cc#newcode173 chrome/browser/search_engines/template_url_service_android.cc:173: } On 2016/12/08 06:56:27, Peter Kasting wrote: > Functionally, ...
4 years ago (2016-12-09 00:53:08 UTC) #20
Peter Kasting
This still needs tests. A test would have caught the functional error below, I think. ...
4 years ago (2016-12-09 01:26:56 UTC) #21
ltian
On 2016/12/09 01:26:56, Peter Kasting wrote: > This still needs tests. A test would have ...
4 years ago (2016-12-09 02:42:44 UTC) #22
Peter Kasting
On 2016/12/09 02:42:44, ltian wrote: > On 2016/12/09 01:26:56, Peter Kasting wrote: > > This ...
4 years ago (2016-12-09 02:44:57 UTC) #23
ltian
On 2016/12/09 02:44:57, Peter Kasting wrote: > On 2016/12/09 02:42:44, ltian wrote: > > On ...
4 years ago (2016-12-09 02:53:54 UTC) #24
Peter Kasting
On 2016/12/09 02:53:54, ltian wrote: > On 2016/12/09 02:44:57, Peter Kasting wrote: > > On ...
4 years ago (2016-12-09 03:04:47 UTC) #25
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/2555513003/80001
4 years ago (2016-12-15 17:44:37 UTC) #33
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started by full ...
4 years ago (2016-12-15 17:44:40 UTC) #35
Ted C
On 2016/12/15 17:44:40, commit-bot: I haz the power wrote: > No L-G-T-M from a valid ...
4 years ago (2016-12-15 18:47:53 UTC) #42
ltian
tedchoc@chromiu.org: could you take a look for the Java changes of my CL? Thanks! https://codereview.chromium.org/2555513003/diff/60001/chrome/browser/search_engines/template_url_service_android.cc ...
4 years ago (2016-12-15 19:02:35 UTC) #43
Ted C
https://codereview.chromium.org/2555513003/diff/80001/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java File chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java (right): https://codereview.chromium.org/2555513003/diff/80001/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java#newcode175 chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java:175: assertEquals(7, searchEngines.size()); I assume the 7 comes from the ...
4 years ago (2016-12-15 21:38:06 UTC) #44
ltian
https://codereview.chromium.org/2555513003/diff/80001/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java File chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java (right): https://codereview.chromium.org/2555513003/diff/80001/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java#newcode175 chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java:175: assertEquals(7, searchEngines.size()); On 2016/12/15 21:38:06, Ted C wrote: > ...
4 years ago (2016-12-15 22:56:54 UTC) #45
Ted C
lgtm https://codereview.chromium.org/2555513003/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java File chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java (right): https://codereview.chromium.org/2555513003/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java#newcode378 chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java:378: public String addSearchEngineForTesting(String keyword, int offset) { update ...
4 years ago (2016-12-15 23:40:37 UTC) #46
Peter Kasting
LGTM https://codereview.chromium.org/2555513003/diff/80001/chrome/browser/search_engines/template_url_service_android.cc File chrome/browser/search_engines/template_url_service_android.cc (right): https://codereview.chromium.org/2555513003/diff/80001/chrome/browser/search_engines/template_url_service_android.cc#newcode174 chrome/browser/search_engines/template_url_service_android.cc:174: // Limit to those three engines which must ...
4 years ago (2016-12-16 08:37:18 UTC) #47
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/2555513003/120001
4 years ago (2016-12-16 20:20:11 UTC) #50
commit-bot: I haz the power
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/124520) ios-device-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, ...
4 years ago (2016-12-16 20:24:11 UTC) #52
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/2555513003/140001
4 years ago (2016-12-16 22:54:39 UTC) #55
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years ago (2016-12-17 00:24:02 UTC) #58
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/dffd7c39dddd7ee52ffde3b877a237b5b877a252 Cr-Commit-Position: refs/heads/master@{#439251}
4 years ago (2016-12-17 00:28:44 UTC) #60
Peter Kasting
I'm a little frustrated that you didn't reply to any of my comments, didn't do ...
4 years ago (2016-12-17 03:16:01 UTC) #61
ltian
On 2016/12/17 03:16:01, Peter Kasting wrote: > I'm a little frustrated that you didn't reply ...
4 years ago (2016-12-21 23:26:53 UTC) #62
Peter Kasting
4 years ago (2016-12-22 00:04:12 UTC) #63
Message was sent while issue was closed.
On 2016/12/21 23:26:53, ltian wrote:
> On 2016/12/17 03:16:01, Peter Kasting wrote:
> > I'm a little frustrated that you didn't reply to any of my comments, didn't
do
> > anything with most of them (and, with the remaining one, did what I
suggested
> > would be the worse solution), and then landed.
> > 
> > It's good form to reply either individually (if needed) or as a group (if
you
> > implemented everything) to give your reactions/followup to various comments.

> > For example, if you decide not to implement a review comment, say why.
> > 
> > Generally an "LGTM" plus comments is intended to mean "LGTM if you do
these",
> > but if you elect not to, or to do something else that disagrees with the
> spirit
> > of the comment, you should probably not land without reviewer OK.
> > 
> > This is not worth reverting the CL over, but please reply to the comments if
> you
> > think the best response is something other than "done", and open a new CL
for
> > any followups that are necessary as a result.
> 
> Sorry I didn't reply to your comments and didn't update for all your comments
> before
> landing it. There are mainly two issues I didn't update. 
> 
> The first one is adding comments to the functions added in
> template_url_service_android.h.
> Because I find that all the public functions in template_url_service_android.h
> doesn't
> have any comments and from their function names, it is straightforward to
learn
> what those
> functions do, so I thought it was better to keep consistent with other
functions
> and
> skipped adding comments on them. But if you think it is better for have
comments
> on them,
> I could add some to them.

You don't have to add comments on functions whose behavior is completely
obvious, but you should have comments about anything that's not, or in any case
where functions have side effects, need parameter explanations, etc.

For more detail, read the "declarations" section of
http://google.github.io/styleguide/cppguide.html#Function_Comments .

> The second issue is leaving UpdateTemplateURLVisitTime() in
> template_url_serivce.h private
> and expose it via a friend declaration. I tried adding
FRIEND_TEST_ALL_PREFIXES(
> TemplateUrlServiceAndroid, UpdateLastVisitedForTesting) to
> template_url_serivce.h but then
> there is an error when compiling the code reporting UpdateTemplateURLVisitTime
> is a private
> member. Because the unnitest is in Java code, I don't know any way to expose a
> friend
> declaration for it so I keep it as before.

I would deal with this by marking TemplateUrlServiceAndroid as a friend and
exposing this publicly there.  Then at least we limit who can call this to
Android-specific code.  It's somewhat reasonable for TemplateUrlServiceAndroid
to be a friend, so this makes sense.

Powered by Google App Engine
This is Rietveld 408576698