diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 22:53:57 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 22:53:57 +0000 |
commit | fb2e07cf33c32e646d20f8a84f8f393c22cf9220 (patch) | |
tree | 91a6062c1eb28a6ad353f242b6cae395e2632928 /chrome/browser/history/history_backend.cc | |
parent | 364fbf861e60bb0e7ed50713f6e4724c38a62931 (diff) | |
download | chromium_src-fb2e07cf33c32e646d20f8a84f8f393c22cf9220.zip chromium_src-fb2e07cf33c32e646d20f8a84f8f393c22cf9220.tar.gz chromium_src-fb2e07cf33c32e646d20f8a84f8f393c22cf9220.tar.bz2 |
Have URL Modifications sent Regardless of Typed.
URL visit adds and modifications are now noticed regardless of typed count. Filtering is no longer done before making notifications. Clients of the notifications filter on typed count if desired. Also, if a change notification indicates that a page title is now blank, ignore that change in the InMemoryURLIndex.
Renamed NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED to NOTIFICATION_HISTORY_URLS_MODIFIED to better reflect its new purpose.
Reviewers:
pkasting: Overall general changes.
sky: Owner review for chrome/browser/history and minor changes in chrome/browser/ui/omnibox.
akalin: TBR: Owner review for minor changes in chrome/browser/sync.
BUG=102957,87803
TEST=All unit tests pass.
TBR=akalin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9852002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_backend.cc')
-rw-r--r-- | chrome/browser/history/history_backend.cc | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index fe305f8..7f3bafb 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -874,7 +874,7 @@ void HistoryBackend::AddPagesWithDetails(const URLRows& urls, // // TODO(brettw) bug 1140015: Add an "add page" notification so the history // views can keep in sync. - BroadcastNotifications(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, modified.release()); ScheduleCommit(); @@ -889,6 +889,10 @@ void HistoryBackend::SetPageTitle(const GURL& url, if (!db_.get()) return; + // Update the full text index. + if (text_database_.get()) + text_database_->AddPageTitle(url, title); + // Search for recent redirects which should get the same title. We make a // dummy list containing the exact URL visited if there are no redirects so // the processing below can be the same. @@ -908,43 +912,24 @@ void HistoryBackend::SetPageTitle(const GURL& url, redirects = &dummy_list; } - bool typed_url_changed = false; - URLRows changed_urls; + scoped_ptr<URLsModifiedDetails> details(new URLsModifiedDetails); for (size_t i = 0; i < redirects->size(); i++) { URLRow row; URLID row_id = db_->GetRowForURL(redirects->at(i), &row); if (row_id && row.title() != title) { row.set_title(title); db_->UpdateURLRow(row_id, row); - changed_urls.push_back(row); - if (row.typed_count() > 0) - typed_url_changed = true; + details->changed_urls.push_back(row); } } - // Broadcast notifications for typed URLs that have changed. This will - // update the in-memory database. - // - // TODO(brettw) bug 1140020: Broadcast for all changes (not just typed), - // in which case some logic can be removed. - if (typed_url_changed) { - URLsModifiedDetails* modified = - new URLsModifiedDetails; - for (size_t i = 0; i < changed_urls.size(); i++) { - if (changed_urls[i].typed_count() > 0) - modified->changed_urls.push_back(changed_urls[i]); - } - BroadcastNotifications(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, - modified); - } - - // Update the full text index. - if (text_database_.get()) - text_database_->AddPageTitle(url, title); - - // Only bother committing if things changed. - if (!changed_urls.empty()) + // Broadcast notifications for any URLs that have changed. This will + // update the in-memory database and the InMemoryURLIndex. + if (!details->changed_urls.empty()) { + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, + details.release()); ScheduleCommit(); + } } void HistoryBackend::AddPageNoVisitForBookmark(const GURL& url) { |