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

Unified Diff: chrome/browser/sync/glue/typed_url_change_processor.cc

Issue 694843002: Remove NOTIFICATION_HISTORY_URLS_MODIFIED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 1 month 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/sync/glue/typed_url_change_processor.cc
diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc
index 51539c91586026de8c63016611ea3c485e3b110a..6ce366f8b80f06fe8e2dc4e7b2ace4fd9f2910fa 100644
--- a/chrome/browser/sync/glue/typed_url_change_processor.cc
+++ b/chrome/browser/sync/glue/typed_url_change_processor.cc
@@ -67,19 +67,15 @@ void TypedUrlChangeProcessor::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(backend_loop_ == base::MessageLoop::current());
+ DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED);
base::AutoLock al(disconnect_lock_);
if (disconnected_)
return;
DVLOG(1) << "Observed typed_url change.";
- if (type == chrome::NOTIFICATION_HISTORY_URLS_MODIFIED) {
- HandleURLsModified(
- content::Details<history::URLsModifiedDetails>(details).ptr());
- } else if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
- HandleURLsDeleted(
- content::Details<history::URLsDeletedDetails>(details).ptr());
- }
+ HandleURLsDeleted(
+ content::Details<history::URLsDeletedDetails>(details).ptr());
UMA_HISTOGRAM_PERCENTAGE("Sync.TypedUrlChangeProcessorErrors",
model_associator_->GetErrorPercentage());
}
@@ -105,18 +101,26 @@ void TypedUrlChangeProcessor::OnURLVisited(
model_associator_->GetErrorPercentage());
}
-void TypedUrlChangeProcessor::HandleURLsModified(
- history::URLsModifiedDetails* details) {
+void TypedUrlChangeProcessor::OnURLsModified(
+ history::HistoryBackend* history_backend,
+ const history::URLRows& changed_urls) {
+ DCHECK(backend_loop_ == base::MessageLoop::current());
+
+ base::AutoLock al(disconnect_lock_);
+ if (disconnected_)
+ return;
+ DVLOG(1) << "Observed typed_url change.";
syncer::WriteTransaction trans(FROM_HERE, share_handle());
- for (history::URLRows::iterator url = details->changed_urls.begin();
- url != details->changed_urls.end(); ++url) {
- if (url->typed_count() > 0) {
+ for (const auto& row : changed_urls) {
+ if (row.typed_count() > 0) {
// If there were any errors updating the sync node, just ignore them and
// continue on to process the next URL.
- CreateOrUpdateSyncNode(*url, &trans);
+ CreateOrUpdateSyncNode(row, &trans);
}
}
+ UMA_HISTOGRAM_PERCENTAGE("Sync.TypedUrlChangeProcessorErrors",
+ model_associator_->GetErrorPercentage());
}
bool TypedUrlChangeProcessor::CreateOrUpdateSyncNode(
@@ -344,9 +348,6 @@ void TypedUrlChangeProcessor::StartObserving() {
DCHECK(history_backend_);
DCHECK(profile_);
notification_registrar_.Add(
- this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED,
- content::Source<Profile>(profile_));
- notification_registrar_.Add(
this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::Source<Profile>(profile_));
history_backend_->AddObserver(this);
@@ -357,9 +358,6 @@ void TypedUrlChangeProcessor::StopObserving() {
DCHECK(history_backend_);
DCHECK(profile_);
notification_registrar_.Remove(
- this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED,
- content::Source<Profile>(profile_));
- notification_registrar_.Remove(
this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::Source<Profile>(profile_));
history_backend_->RemoveObserver(this);
« no previous file with comments | « chrome/browser/sync/glue/typed_url_change_processor.h ('k') | chrome/browser/sync/profile_sync_service_typed_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698