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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 2723953002: [sync] skeleton implementation of TypedURLSyncBridge (Closed)
Patch Set: rebase and address missing parts for bug 558320 Created 3 years, 10 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: components/history/core/browser/history_backend.cc
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index 62187120cff3ae3d97a93a60b1fdcd8759dff2e5..32cbcefb06a11c32af73e213dd65568a1f0442e2 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -15,6 +15,8 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/debug/dump_without_crashing.h"
+#include "base/feature_list.h"
#include "base/files/file_enumerator.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
@@ -39,8 +41,10 @@
#include "components/history/core/browser/in_memory_history_backend.h"
#include "components/history/core/browser/keyword_search_term.h"
#include "components/history/core/browser/page_usage_data.h"
+#include "components/history/core/browser/typed_url_sync_bridge.h"
#include "components/history/core/browser/typed_url_syncable_service.h"
#include "components/history/core/browser/url_utils.h"
+#include "components/sync/driver/sync_driver_switches.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "sql/error_delegate_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -52,9 +56,11 @@
#include "base/ios/scoped_critical_action.h"
#endif
+using base::debug::DumpWithoutCrashing;
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
+using syncer::ModelTypeChangeProcessor;
/* The HistoryBackend consists of two components:
@@ -211,7 +217,17 @@ void HistoryBackend::Init(
if (!force_fail)
InitImpl(history_database_params);
delegate_->DBLoaded();
- typed_url_syncable_service_.reset(new TypedUrlSyncableService(this));
+ if (base::FeatureList::IsEnabled(switches::kSyncUSSTypedURL)) {
+ typed_url_sync_bridge_ = base::MakeUnique<TypedURLSyncBridge>(
+ this,
+ base::BindRepeating(
+ &ModelTypeChangeProcessor::Create,
+ base::BindRepeating(base::IgnoreResult(&DumpWithoutCrashing))));
skym 2017/03/07 18:08:04 Ugh. Okay, this is kind of a land mine that we're
Gang Wu 2017/03/31 19:35:58 Done.
+ } else {
+ typed_url_syncable_service_ =
+ base::MakeUnique<TypedUrlSyncableService>(this);
+ }
+
memory_pressure_listener_.reset(new base::MemoryPressureListener(
base::Bind(&HistoryBackend::OnMemoryPressure, base::Unretained(this))));
}
@@ -1031,6 +1047,10 @@ TypedUrlSyncableService* HistoryBackend::GetTypedUrlSyncableService() const {
return typed_url_syncable_service_.get();
}
+TypedURLSyncBridge* HistoryBackend::GetTypedURLSyncBridge() const {
+ return typed_url_sync_bridge_.get();
+}
+
// Statistics ------------------------------------------------------------------
HistoryCountResult HistoryBackend::GetHistoryCount(const Time& begin_time,

Powered by Google App Engine
This is Rietveld 408576698