|
|
Chromium Code Reviews
Description[Android] Hide "Recently visited" text if there is not custom search engine
Currently even there is no custom search engine to show (such as clean
start), "Recently visited" header will still be displayed. This
is confusing for users.
To fix this, there is no custom search engine to show, remove the "Recently
visited" header.
BUG=679608
Review-Url: https://codereview.chromium.org/2623113002
Cr-Commit-Position: refs/heads/master@{#443476}
Committed: https://chromium.googlesource.com/chromium/src/+/1b87f94692daf34c6525f0beaf798aab1657380a
Patch Set 1 #
Total comments: 4
Patch Set 2 : Update based on Dan's comments. #
Total comments: 2
Patch Set 3 : Update based on Dan's comment. #Messages
Total messages: 22 (12 generated)
The CQ bit was checked by ltian@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
ltian@chromium.org changed reviewers: + dfalcantara@chromium.org
dfalcantara@chromium.org: can you take a look of my change in this CL? Thanks!
Also your title is kind of weird. "is no custom search engine" maybe? https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java (right): https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:158: return mPrepopulatedSearchEngines == null ? 0 Any time it's this complicated, use an if block. The indentation here makes it really hard to understand what you're actually doing and makes it look like the second level belongs to the first because it's indented less than the condition it actually belongs to. https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:378: if (mRecentSearchEngines.size() > 0) { You're effectively returning 0 or adding one to the true size, right? Add a comment explaining why here. Makes it so that the next person looking at this code doesn't have to look up your commit message to understand why.
On 2017/01/11 18:11:47, dfalcantara (check queue) wrote: > Also your title is kind of weird. "is no custom search engine" maybe? > > https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... > File > chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java > (right): > > https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... > chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:158: > return mPrepopulatedSearchEngines == null ? 0 > Any time it's this complicated, use an if block. The indentation here makes it > really hard to understand what you're actually doing and makes it look like the > second level belongs to the first because it's indented less than the condition > it actually belongs to. > > https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... > chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:378: > if (mRecentSearchEngines.size() > 0) { > You're effectively returning 0 or adding one to the true size, right? Add a > comment explaining why here. Makes it so that the next person looking at this > code doesn't have to look up your commit message to understand why. Or maybe "no custom search engine set"?
The CQ bit was checked by ltian@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java (right): https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:158: return mPrepopulatedSearchEngines == null ? 0 On 2017/01/11 18:11:47, dfalcantara (check queue) wrote: > Any time it's this complicated, use an if block. The indentation here makes it > really hard to understand what you're actually doing and makes it look like the > second level belongs to the first because it's indented less than the condition > it actually belongs to. Done. https://codereview.chromium.org/2623113002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:378: if (mRecentSearchEngines.size() > 0) { On 2017/01/11 18:11:47, dfalcantara (check queue) wrote: > You're effectively returning 0 or adding one to the true size, right? Add a > comment explaining why here. Makes it so that the next person looking at this > code doesn't have to look up your commit message to understand why. Done.
https://codereview.chromium.org/2623113002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java (right): https://codereview.chromium.org/2623113002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:163: return 0; Was trying to get rid of the ternary operators entirely and make it easier to understand what was going on here. How about this: { int size = 0; if (mPrepopulatedSearchEngines != null) { size += mPrepopulatedEngines.size(); } if (mRecentSearchEngines.size() != null && mRecentSearchEngines.size() != 0) { // Account for the header by adding one to the size. size = mRecentSearchEngines.size() + 1; } return size; }
https://codereview.chromium.org/2623113002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java (right): https://codereview.chromium.org/2623113002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java:163: return 0; On 2017/01/12 21:26:05, dfalcantara (check queue) wrote: > Was trying to get rid of the ternary operators entirely and make it easier to > understand what was going on here. How about this: > > { > int size = 0; > > if (mPrepopulatedSearchEngines != null) { > size += mPrepopulatedEngines.size(); > } > > if (mRecentSearchEngines.size() != null && mRecentSearchEngines.size() != 0) > { > // Account for the header by adding one to the size. > size = mRecentSearchEngines.size() + 1; > } > > return size; > } Done.
lgtm
The CQ bit was checked by ltian@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 40001, "attempt_start_ts": 1484273390540450,
"parent_rev": "5cc4c469882d169f8efb789ff82235252f40f270", "commit_rev":
"1b87f94692daf34c6525f0beaf798aab1657380a"}
Message was sent while issue was closed.
Description was changed from ========== [Android] Hide "Recently visited" text if there is not custom search engine Currently even there is no custom search engine to show (such as clean start), "Recently visited" header will still be displayed. This is confusing for users. To fix this, there is no custom search engine to show, remove the "Recently visited" header. BUG=679608 ========== to ========== [Android] Hide "Recently visited" text if there is not custom search engine Currently even there is no custom search engine to show (such as clean start), "Recently visited" header will still be displayed. This is confusing for users. To fix this, there is no custom search engine to show, remove the "Recently visited" header. BUG=679608 Review-Url: https://codereview.chromium.org/2623113002 Cr-Commit-Position: refs/heads/master@{#443476} Committed: https://chromium.googlesource.com/chromium/src/+/1b87f94692daf34c6525f0beaf79... ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/1b87f94692daf34c6525f0beaf79... |
