How to edit “Most Visited” section of new tab page in Chromium



“Most Visited” section on new tab in Chrome/Chromium can be edited by hand, by directly changing “Top Sites” sqlite3 database inside Chrome/Chromium with sqlite3 and SQL (or by any other sqlite3 db editor, like sqlitebrowser).

The “Top Sites” database is located in user profile directory, the default one is “~/.config/chromium/Default/Top Sites” (for chrome: ~/.config/google-chrome/default, in windows C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default).

To edit it, close the Chromium/Chrome and run for GUI editor

sudo apt-get install sqlitebrowser
sqlitebrowser ~/.config/chromium/Default/Top\ Sites

Open thumbnails table in Browse Data tab. We (and forensics experts) can see much more entries than is shown in “Most Visited”.

Only eight sites with smallest “url rank” and not blacklisted by user are shown. You can see them with such SQL query (via “Execute SQL” tab in sqlitebrowser or by using sqlite3 ~/.config/chromium/Default/Top\ Sites command line tool):

select url, url_rank, at_top from thumbnails order by url_rank;

Now you can edit the database, changing url_ranks to reorder sites (you should shift half of url_ranks, if you are inserting in middle). You can ever add new url, and change all url_ranks to move your new url into “Most Visited”.

When user deleted the site from “Most Visited” section by clicking “x” button, the url is blacklisted in the JSON config file ~/.config/chromium/Default/Preferences, in ntp.most_visited_blacklist section (close the Chrome, open the Preferences with text editor like gedit or vim, search for most_visited_blacklist and see URLHashes of blacklisted sites, implemented as MD5 of url string). You can delete all urls from most_visited_blacklist section (make sure that you have backup of Preferences file)

PS Actual source code of “Most Visited” implementation in Chromium: chrome/browser/history/ file, line 438, void TopSitesDatabase::GetPageThumbnails function:

  "SELECT url, url_rank, title, thumbnail, redirects, "
  "boring_score, good_clipping, at_top, last_updated, load_completed, "
  "last_forced FROM thumbnails ORDER BY url_rank, last_forced"));

// Results are sorted by url_rank. For forced thumbnails with url_rank = -1,
// thumbnails are sorted by last_forced.

Descriptions of some table fields are here: chrome/common/thumbnail_score.h

Blacklisting implemented in chrome/browser/history/, TopSitesImpl::AddBlacklistedURL, TopSitesImpl::RemoveBlacklistedURL (Hmm, used only by test, but not accessible in UI some time after url was blacklisted?)