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

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

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review #1 Created 9 years, 3 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/sync/glue/extension_setting_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/extension_setting_data_type_controller.cc b/chrome/browser/sync/glue/extension_setting_data_type_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ac49a768a711b4c5b39f8b7aeed4910e7ff009bf
--- /dev/null
+++ b/chrome/browser/sync/glue/extension_setting_data_type_controller.cc
@@ -0,0 +1,83 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/glue/extension_setting_data_type_controller.h"
+
+#include "base/metrics/histogram.h"
+#include "chrome/browser/sync/api/syncable_service.h"
+#include "chrome/browser/sync/glue/generic_change_processor.h"
+#include "content/browser/browser_thread.h"
+
+namespace browser_sync {
+
+ExtensionSettingDataTypeController::ExtensionSettingDataTypeController(
+ ProfileSyncFactory* profile_sync_factory,
+ Profile* profile,
+ ProfileSyncService* profile_sync_service)
+ : NonFrontendDataTypeController(profile_sync_factory, profile),
+ profile_sync_service_(profile_sync_service) {}
+
+ExtensionSettingDataTypeController::~ExtensionSettingDataTypeController() {}
+
+syncable::ModelType ExtensionSettingDataTypeController::type() const {
+ return syncable::EXTENSION_SETTINGS;
+}
+
+browser_sync::ModelSafeGroup
+ExtensionSettingDataTypeController::model_safe_group() const {
+ return browser_sync::GROUP_FILE;
+}
+
+bool ExtensionSettingDataTypeController::StartModels() {
+ return true;
+}
+
+bool ExtensionSettingDataTypeController::StartAssociationAsync() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_EQ(state(), ASSOCIATING);
+ BrowserThread::PostTask(
akalin 2011/09/15 19:56:44 if (!PostTask) { NOTREACHED(); }
not at google - send to devlin 2011/09/16 05:18:59 Done.
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&ExtensionSettingDataTypeController::StartAssociation, this));
+ return true;
+}
+
+void ExtensionSettingDataTypeController::CreateSyncComponents() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_EQ(state(), ASSOCIATING);
+ ProfileSyncFactory::SyncComponents sync_components =
+ profile_sync_factory()->CreateExtensionSettingSyncComponents(
+ profile_sync_service_, this);
+ set_model_associator(sync_components.model_associator);
+ set_change_processor(sync_components.change_processor);
+}
+
+bool ExtensionSettingDataTypeController::StopAssociationAsync() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_EQ(state(), STOPPING);
+ BrowserThread::PostTask(
akalin 2011/09/15 19:56:44 if (!PostTask()) { NOTREACHED(); }
not at google - send to devlin 2011/09/16 05:18:59 Done.
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&ExtensionSettingDataTypeController::StopAssociation, this));
+ return true;
+}
+
+void ExtensionSettingDataTypeController::RecordUnrecoverableError(
+ const tracked_objects::Location& from_here,
+ const std::string& message) {
+ UMA_HISTOGRAM_COUNTS("Sync.ExtensionSettingRunFailures", 1);
+}
+
+void ExtensionSettingDataTypeController::RecordAssociationTime(
+ base::TimeDelta time) {
+ UMA_HISTOGRAM_TIMES("Sync.ExtensionSettingAssociationTime", time);
+}
+
+void ExtensionSettingDataTypeController::RecordStartFailure(
+ StartResult result) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Sync.ExtensionSettingStartFailures", result, MAX_START_RESULT);
+}
+
+} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698