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

Issue 27057004: Make the OmniboxNavigationObserver update the ShortcutsProvider. (Closed)

Created:
7 years, 2 months ago by Peter Kasting
Modified:
7 years, 2 months ago
Reviewers:
Bart N., brettw, sky
CC:
chromium-reviews, James Su, browser-components-watch_chromium.org
Visibility:
Public.

Description

Make the OmniboxNavigationObserver update the ShortcutsProvider. This means the ShortcutsProvider will only store shortcuts to successful navigations, eliminating a major source of bad omnibox suggestions. BUG=151044 TEST=Type "sughoidusgbpoiun.com" in omnibox, hit enter; retype "sugho" and ensure old bogus URL is not suggested R=brettw@chromium.org, sky@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=228846

Patch Set 1 #

Patch Set 2 : #

Total comments: 14

Patch Set 3 : #

Patch Set 4 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -50 lines) Patch
M chrome/browser/history/shortcuts_backend.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/history/shortcuts_backend.cc View 1 2 3 chunks +32 lines, -39 lines 0 comments Download
M chrome/browser/ui/omnibox/omnibox_edit_model.cc View 1 2 5 chunks +9 lines, -5 lines 0 comments Download
M chrome/browser/ui/omnibox/omnibox_navigation_observer.h View 1 2 3 5 chunks +19 lines, -5 lines 0 comments Download
M chrome/browser/ui/omnibox/omnibox_navigation_observer.cc View 1 2 3 5 chunks +18 lines, -1 line 1 comment Download

Messages

Total messages: 8 (0 generated)
Peter Kasting
There may still be an issue with the ShortcutsBackend being NULL in some scenarios, but ...
7 years, 2 months ago (2013-10-14 20:53:15 UTC) #1
Bart N.
Are you planning to add some unit tests? https://codereview.chromium.org/27057004/diff/10001/chrome/browser/history/shortcuts_backend.cc File chrome/browser/history/shortcuts_backend.cc (right): https://codereview.chromium.org/27057004/diff/10001/chrome/browser/history/shortcuts_backend.cc#newcode194 chrome/browser/history/shortcuts_backend.cc:194: string16 ...
7 years, 2 months ago (2013-10-14 21:31:54 UTC) #2
sky
LGTM
7 years, 2 months ago (2013-10-14 22:57:27 UTC) #3
brettw
history lgtm rubberstamp
7 years, 2 months ago (2013-10-15 17:51:10 UTC) #4
Peter Kasting
https://codereview.chromium.org/27057004/diff/10001/chrome/browser/history/shortcuts_backend.cc File chrome/browser/history/shortcuts_backend.cc (right): https://codereview.chromium.org/27057004/diff/10001/chrome/browser/history/shortcuts_backend.cc#newcode194 chrome/browser/history/shortcuts_backend.cc:194: string16 text_lowercase(base::i18n::ToLower(text)); On 2013/10/14 21:31:54, Bart N. wrote: > ...
7 years, 2 months ago (2013-10-16 01:28:55 UTC) #5
Peter Kasting
Committed patchset #4 manually as r228846 (presubmit successful).
7 years, 2 months ago (2013-10-16 03:05:32 UTC) #6
Bart N.
What is your decision regarding the functional test we discussed yesterday? Secondly, I've noticed you ...
7 years, 2 months ago (2013-10-16 17:42:46 UTC) #7
Peter Kasting
7 years, 2 months ago (2013-10-16 21:48:58 UTC) #8
Message was sent while issue was closed.
On 2013/10/16 17:42:46, Bart N. wrote:
> What is your decision regarding the functional test we discussed yesterday?

As I noted to you in my office, my intent was to not implement such a test.

> Secondly, I've noticed you already submitted this CL although I haven't
LGTMed.
> I was under impression you asked me for shortcuts review? I still believe this
> CL needs more work.

Sorry, my mistake.  Somehow I had it in my head that you'd already signed off. 
I didn't intend to bypass you, I just screwed up :(.  If there are more changes
I can land those as a followup.

>
https://codereview.chromium.org/27057004/diff/10001/chrome/browser/history/sh...
> chrome/browser/history/shortcuts_backend.cc:235: if (content::Details<const
> history::URLsDeletedDetails>(details)->
> On 2013/10/16 01:28:55, Peter Kasting wrote:
> > On 2013/10/14 21:31:54, Bart N. wrote:
> > > Style: -> should be on the second line.
> > 
> > Operators go on ends of lines, not starts.  But I solved this a different
way
> by
> > factoring out a temp.
> Interesting, unlike the internal Google style.

The style guide only addresses boolean operators directly, but its comment is
that EOL operators are more common:

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Boolea...

> 
>
https://codereview.chromium.org/27057004/diff/41001/chrome/browser/ui/omnibox...
> File chrome/browser/ui/omnibox/omnibox_navigation_observer.cc (right):
> 
>
https://codereview.chromium.org/27057004/diff/41001/chrome/browser/ui/omnibox...
> chrome/browser/ui/omnibox/omnibox_navigation_observer.cc:80: if
> (shortcuts_backend_)
> This looks odd. The only place where you assign shortcuts_backend_ is in the
> constructor and my understanding is that
> ShortcutsBackendFactory::GetForProfile(profile) may return NULL.
> 
> If so, would it be possible to avoid listening on successful notification if
the
> backend is NULL? What's the point otherwise?

It's possible to avoid being called back if both (a) the shortcuts backend is
NULL and (b) we don't have an infobar to possibly show for the alternate nav URL
case.

However, there are a few reasons I didn't bother to try and implement that:
(1) We still have to conditional-check the shortcuts backend in
OnSuccessfulNavigation(), because the omnibox can call it directly.
(2) Trying to calculate the cases where we could delete ourself somewhat earlier
is more code and more error-prone than having a consistent lifetime.
(3) The actual cost of this thing living longer is trivial.  The number of
omnibox navigations in flight at any one time is not large enough for there to
be meaningful perf or memory impact from this.
(4) I intend to expand this class yet further in the future to accommodate other
users that need to monitor omnibox navigations, so just staying alive
consistently makes that easier.

Powered by Google App Engine
This is Rietveld 408576698