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

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

Issue 12703036: [Sync] Add interface and backend impl for typed URL syncable service (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style and move logic into BroadcastNotifications Created 7 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
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 327896b44682c53e6ce3694ddcd1d2473361bc52..c34bc983abff140532fc4b24fa5de25e7bc7f2e2 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,
@@ -889,6 +891,7 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit(
URLVisitedDetails* details = new URLVisitedDetails;
details->transition = transition;
details->row = url_info;
+
Andrew T Wilson (Slow) 2013/04/10 08:43:22 nit: remove extraneous blank line
// TODO(meelapshah) Disabled due to potential PageCycler regression.
// Re-enable this.
// GetMostRecentRedirectsTo(url, &details->redirects);
@@ -1174,6 +1177,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 +2867,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: {
+ 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 --------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698