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

Issue 9689085: Clean up ShortcutsProvider and related classes. (Closed)

Created:
8 years, 9 months ago by Peter Kasting
Modified:
8 years, 9 months ago
Reviewers:
GeorgeY, brettw
CC:
chromium-reviews, James Su, brettw-cc_chromium.org
Visibility:
Public.

Description

Clean up ShortcutsProvider and related classes: * Move SpansToString()/SpansFromString() and AddLastMatchIfNeeded() from static functions in shortcuts_provider_shortcut.cc to static members on AutocompleteMatch and rename them, to go along with the other existing classification-related functions there, since there's nothing particularly shortcut-related about them. * Move the definitions of Shortcut and ShortcutMap to the ShortcutsBackend, mainly to "namespace" them -- having a global-scope type named "Shortcut" didn't seem like a good idea. This made sense as a location anyway since the backend already depended heavily on these types. * Eliminate using statements. * Modify ShortcutsProviderTest::FillData() so it can be reused in an additional place. * Shortcut had two different constructors whose function and use was confusing and error-prone -- they took some of the same fields but as different types, and didn't guarantee all the members were initialized. Condense to one constructor which takes the most logical types and sets all members. * Eliminate ShortcutsBackend::guid_map() (unused). * Simplify/clarify code. * Eliminate 2K clamp on shortcut data fields. We don't clamp like this elsewhere, and if the clamp kicks in, it could lead to corrupted results -- e.g. trimming a "description" field but not updating the classifications for that field. BUG=none TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=126743

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+338 lines, -499 lines) Patch
M chrome/browser/autocomplete/autocomplete_match.h View 1 chunk +15 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_match.cc View 2 chunks +48 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/shortcuts_provider.h View 3 chunks +5 lines, -7 lines 0 comments Download
M chrome/browser/autocomplete/shortcuts_provider.cc View 7 chunks +23 lines, -25 lines 4 comments Download
D chrome/browser/autocomplete/shortcuts_provider_shortcut.h View 1 chunk +0 lines, -86 lines 0 comments Download
D chrome/browser/autocomplete/shortcuts_provider_shortcut.cc View 1 chunk +0 lines, -130 lines 0 comments Download
M chrome/browser/autocomplete/shortcuts_provider_unittest.cc View 7 chunks +20 lines, -48 lines 0 comments Download
M chrome/browser/history/shortcuts_backend.h View 6 chunks +49 lines, -13 lines 1 comment Download
M chrome/browser/history/shortcuts_backend.cc View 9 chunks +94 lines, -79 lines 0 comments Download
M chrome/browser/history/shortcuts_backend_unittest.cc View 4 chunks +35 lines, -36 lines 0 comments Download
M chrome/browser/history/shortcuts_database.h View 3 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/history/shortcuts_database.cc View 5 chunks +22 lines, -41 lines 0 comments Download
M chrome/browser/history/shortcuts_database_unittest.cc View 8 chunks +21 lines, -27 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Peter Kasting
georgey: To review brettw: OWNERS stamp for history/
8 years, 9 months ago (2012-03-13 22:27:18 UTC) #1
brettw
History owners LGTM, I didn't really review the details. https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/history/shortcuts_backend.h File chrome/browser/history/shortcuts_backend.h (right): https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/history/shortcuts_backend.h#newcode54 chrome/browser/history/shortcuts_backend.h:54: ...
8 years, 9 months ago (2012-03-13 22:47:23 UTC) #2
GeorgeY
LGTM with a nit https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomplete/shortcuts_provider.cc File chrome/browser/autocomplete/shortcuts_provider.cc (right): https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomplete/shortcuts_provider.cc#newcode225 chrome/browser/autocomplete/shortcuts_provider.cc:225: match_start, ACMatchClassification::MATCH); May be move ...
8 years, 9 months ago (2012-03-14 19:59:49 UTC) #3
Peter Kasting
https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomplete/shortcuts_provider.cc File chrome/browser/autocomplete/shortcuts_provider.cc (right): https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomplete/shortcuts_provider.cc#newcode225 chrome/browser/autocomplete/shortcuts_provider.cc:225: match_start, ACMatchClassification::MATCH); On 2012/03/14 19:59:49, GeorgeY wrote: > May ...
8 years, 9 months ago (2012-03-14 20:37:34 UTC) #4
GeorgeY
8 years, 9 months ago (2012-03-14 20:50:23 UTC) #5
On 2012/03/14 20:37:34, Peter Kasting wrote:
>
https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomp...
> File chrome/browser/autocomplete/shortcuts_provider.cc (right):
> 
>
https://chromiumcodereview.appspot.com/9689085/diff/1/chrome/browser/autocomp...
> chrome/browser/autocomplete/shortcuts_provider.cc:225: match_start,
> ACMatchClassification::MATCH);
> On 2012/03/14 19:59:49, GeorgeY wrote:
> > May be move &match_class, to the same line as the rest of the parameters?
> Right
> > now it looks like two different styles are used.
> 
> This is explicitly OK: search for the "AndAnotherLongFunctionCall" example in
> http://dev.chromium.org/developers/coding-style .
OK, I see. LGTM, then

Powered by Google App Engine
This is Rietveld 408576698