Chromium Code Reviews| Index: chrome/browser/history/history_backend.cc |
| diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc |
| index 327896b44682c53e6ce3694ddcd1d2473361bc52..16635bfdb7bb8506bd7533dadd6bc23b1562a5c9 100644 |
| --- a/chrome/browser/history/history_backend.cc |
| +++ b/chrome/browser/history/history_backend.cc |
| @@ -33,6 +33,7 @@ |
| #include "chrome/browser/history/page_usage_data.h" |
| #include "chrome/browser/history/select_favicon_frames.h" |
| #include "chrome/browser/history/top_sites.h" |
| +#include "chrome/browser/history/typed_url_syncable_service.h" |
| #include "chrome/browser/history/visit_filter.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_notification_types.h" |
| @@ -296,6 +297,7 @@ void HistoryBackend::Init(const std::string& languages, bool force_fail) { |
| if (!force_fail) |
| InitImpl(languages); |
| delegate_->DBLoaded(id_); |
| + typed_url_syncable_service_.reset(new TypedUrlSyncableService(this)); |
| } |
| void HistoryBackend::SetOnBackendDestroyTask(MessageLoop* message_loop, |
| @@ -1174,6 +1176,10 @@ void HistoryBackend::QueryURL(scoped_refptr<QueryURLRequest> request, |
| request->ForwardResult(request->handle(), success, row, visits); |
| } |
| +TypedUrlSyncableService* HistoryBackend::GetTypedUrlSyncableService() const { |
| + return typed_url_syncable_service_.get(); |
| +} |
| + |
| // Segment usage --------------------------------------------------------------- |
| void HistoryBackend::DeleteOldSegmentData() { |
| @@ -2860,11 +2866,35 @@ void HistoryBackend::BroadcastNotifications( |
| int type, |
| HistoryDetails* details_deleted) { |
| // |delegate_| may be NULL if |this| is in the process of closing (closed by |
| - // HistoryService -> HistroyBackend::Closing(). |
| - if (delegate_.get()) |
| + // HistoryService -> HistoryBackend::Closing(). |
| + if (delegate_.get()) { |
| + // Typed urls sync service is called here to handle deleted urls, including |
| + // expirations from ExpireHistoryBackend, new, modified, and visited urls |
| + if (typed_url_syncable_service_.get()) { |
| + switch (type) { |
| + case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { |
|
brettw
2013/04/20 05:14:18
I don't think it makes sense to key off of the not
mgist1
2013/04/22 20:47:05
Just to clarify, would it be better to remove this
|
| + typed_url_syncable_service_->OnUrlsDeleted( |
| + static_cast<history::URLsDeletedDetails*>(details_deleted)); |
| + break; |
| + } |
| + case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: { |
| + typed_url_syncable_service_->OnUrlsModified( |
| + static_cast<history::URLsModifiedDetails*>(details_deleted)); |
| + break; |
| + } |
| + case chrome::NOTIFICATION_HISTORY_URL_VISITED: { |
| + typed_url_syncable_service_->OnUrlVisited( |
| + static_cast<history::URLVisitedDetails*>(details_deleted)); |
| + break; |
| + } |
| + default: |
| + break; |
| + } |
| + } |
| delegate_->BroadcastNotifications(type, details_deleted); |
| - else |
| + } else { |
| delete details_deleted; |
| + } |
| } |
| // Deleting -------------------------------------------------------------------- |