• Tommy Li's avatar
    [search_engines] Stop trying to prevent keyword conflicts in Update() · 92fca4ae
    Tommy Li authored
    We're removing the invariant that two non-extension search engines
    cannot share the same keyword.
    
    This invariant was untenable because of Sync, Play API, and Policy.
    It was also kind of a weak invariant because extensions have always
    been able to create duplicate keywords.
    
    The invariant was costly, because it was a big source of duplicate
    search engines caused by appending underscores to uniquify keywords.
    
    And the invariant was not needed, because AddToMaps() already handles
    duplicate keywords by choosing the best engine, since extensions have
    always been able to introduce duplicate keywords.
    
    This CL changes the Update() method to no longer attempt to keep
    non-extension engine keywords unique, for a couple of reasons:
    
     1. Simplify the code.
    
     2. The conflict avoidance logic only worked as long as we keep the
        invariant true, and we're removing the invariant. Concretely,
        we plan on having Add() no longer uniquify keywords, and this
        logic crashes in that world. See:
        https://chromium-review.googlesource.com/c/chromium/src/+/2515679
    
     3. Having Update() sometimes silently fail to update the keyword
        actually seems a bit strange to me, and is potentially a source of
        Sync conflicts, since two clients could disagree on whether they
        update the keyword or not.
    
    Bug: 1022775
    Change-Id: I97d2379414dbe7e7ea9e12148428cc3c17d0bba7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519775
    Commit-Queue: Tommy Li <tommycli@chromium.org>
    Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#824212}
    92fca4ae
template_url_service.cc 89.2 KB