Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / glue / search_engine_data_type_controller.cc
index 351fe6d..5ac663a 100644 (file)
@@ -7,8 +7,9 @@
 #include "base/metrics/histogram.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/sync/profile_sync_components_factory.h"
+#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
 #include "chrome/browser/sync/profile_sync_service.h"
+#include "content/public/browser/browser_thread.h"
 #include "sync/api/syncable_service.h"
 
 using content::BrowserThread;
@@ -16,13 +17,19 @@ using content::BrowserThread;
 namespace browser_sync {
 
 SearchEngineDataTypeController::SearchEngineDataTypeController(
-    ProfileSyncComponentsFactory* profile_sync_factory,
-    Profile* profile,
-    ProfileSyncService* sync_service)
-    : UIDataTypeController(syncer::SEARCH_ENGINES,
-                           profile_sync_factory,
-                           profile,
-                           sync_service) {
+    sync_driver::SyncApiComponentFactory* sync_factory,
+    Profile* profile)
+    : UIDataTypeController(
+          BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
+          base::Bind(&ChromeReportUnrecoverableError),
+          syncer::SEARCH_ENGINES,
+          sync_factory),
+      profile_(profile) {
+}
+
+TemplateURLService::Subscription*
+SearchEngineDataTypeController::GetSubscriptionForTesting() {
+  return template_url_subscription_.get();
 }
 
 SearchEngineDataTypeController::~SearchEngineDataTypeController() {}
@@ -48,6 +55,10 @@ bool SearchEngineDataTypeController::StartModels() {
   return false;  // Don't continue Start.
 }
 
+void SearchEngineDataTypeController::StopModels() {
+  template_url_subscription_.reset();
+}
+
 void SearchEngineDataTypeController::OnTemplateURLServiceLoaded() {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
   DCHECK_EQ(state_, MODEL_STARTING);