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

Unified Diff: chrome/browser/history/history_backend.cc

Issue 9852002: Have URL Modifications sent Regardless of Typed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/history_backend.cc
===================================================================
--- chrome/browser/history/history_backend.cc (revision 131849)
+++ chrome/browser/history/history_backend.cc (working copy)
@@ -874,7 +874,7 @@
//
// 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 @@
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 @@
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) {
« no previous file with comments | « chrome/browser/history/expire_history_backend_unittest.cc ('k') | chrome/browser/history/in_memory_history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698