summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/sync_frontend.h
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 16:07:13 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 16:07:13 +0000
commita0e77d34b23643174e25fb509a516efad179d57f (patch)
tree117ff89c38a021b453ad86b71e55b53652167d34 /components/sync_driver/sync_frontend.h
parent3a37a8029b0ffb8a101cdf1a202db83edd245e27 (diff)
downloadchromium_src-a0e77d34b23643174e25fb509a516efad179d57f.zip
chromium_src-a0e77d34b23643174e25fb509a516efad179d57f.tar.gz
chromium_src-a0e77d34b23643174e25fb509a516efad179d57f.tar.bz2
Create sync_driver component.
This CL creates the sync_driver component and moves files with no problematic dependencies from //chrome/browser/sync and //chrome/browser/sync/glue into it. This is a first step toward componentization of //chrome/browser/sync. BUG=339727 Review URL: https://codereview.chromium.org/133343007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/sync_driver/sync_frontend.h')
-rw-r--r--components/sync_driver/sync_frontend.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/components/sync_driver/sync_frontend.h b/components/sync_driver/sync_frontend.h
new file mode 100644
index 0000000..2b30df1
--- /dev/null
+++ b/components/sync_driver/sync_frontend.h
@@ -0,0 +1,112 @@
+// Copyright 2014 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.
+
+#ifndef COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_
+#define COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_
+
+#include "base/basictypes.h"
+#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/sync_encryption_handler.h"
+#include "sync/internal_api/public/sync_manager.h"
+#include "sync/internal_api/public/util/weak_handle.h"
+#include "sync/protocol/sync_protocol_error.h"
+
+namespace syncer {
+class DataTypeDebugInfoListener;
+class JsBackend;
+} // namespace syncer
+
+namespace sync_pb {
+class EncryptedData;
+} // namespace sync_pb
+
+namespace browser_sync {
+
+// SyncFrontend is the interface used by SyncBackendHost to communicate with
+// the entity that created it and, presumably, is interested in sync-related
+// activity.
+// NOTE: All methods will be invoked by a SyncBackendHost on the same thread
+// used to create that SyncBackendHost.
+class SyncFrontend {
+ public:
+ SyncFrontend();
+ virtual ~SyncFrontend();
+
+ // The backend has completed initialization and it is now ready to
+ // accept and process changes. If success is false, initialization
+ // wasn't able to be completed and should be retried.
+ //
+ // |js_backend| is what about:sync interacts with; it's different
+ // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It
+ // is initialized only if |success| is true.
+ virtual void OnBackendInitialized(
+ const syncer::WeakHandle<syncer::JsBackend>& js_backend,
+ const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
+ debug_info_listener,
+ bool success) = 0;
+
+ // The backend queried the server recently and received some updates.
+ virtual void OnSyncCycleCompleted() = 0;
+
+ // Configure ran into some kind of error. But it is scheduled to be
+ // retried.
+ virtual void OnSyncConfigureRetry() = 0;
+
+ // The status of the connection to the sync server has changed.
+ virtual void OnConnectionStatusChange(
+ syncer::ConnectionStatus status) = 0;
+
+ // We are no longer permitted to communicate with the server. Sync should
+ // be disabled and state cleaned up at once.
+ virtual void OnStopSyncingPermanently() = 0;
+
+ // The syncer requires a passphrase to decrypt sensitive updates. This is
+ // called when the first sensitive data type is setup by the user and anytime
+ // the passphrase is changed by another synced client. |reason| denotes why
+ // the passphrase was required. |pending_keys| is a copy of the
+ // cryptographer's pending keys to be passed on to the frontend in order to
+ // be cached.
+ virtual void OnPassphraseRequired(
+ syncer::PassphraseRequiredReason reason,
+ const sync_pb::EncryptedData& pending_keys) = 0;
+
+ // Called when the passphrase provided by the user is
+ // accepted. After this is called, updates to sensitive nodes are
+ // encrypted using the accepted passphrase.
+ virtual void OnPassphraseAccepted() = 0;
+
+ // Called when the set of encrypted types or the encrypt everything
+ // flag has been changed. Note that encryption isn't complete until
+ // the OnEncryptionComplete() notification has been sent (see
+ // below).
+ //
+ // |encrypted_types| will always be a superset of
+ // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is
+ // true, |encrypted_types| will be the set of all known types.
+ //
+ // Until this function is called, observers can assume that the set
+ // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that
+ // the encrypt everything flag is false.
+ virtual void OnEncryptedTypesChanged(
+ syncer::ModelTypeSet encrypted_types,
+ bool encrypt_everything) = 0;
+
+ // Called after we finish encrypting the current set of encrypted
+ // types.
+ virtual void OnEncryptionComplete() = 0;
+
+ // Called to perform migration of |types|.
+ virtual void OnMigrationNeededForTypes(syncer::ModelTypeSet types) = 0;
+
+ // Inform the Frontend that new datatypes are available for registration.
+ virtual void OnExperimentsChanged(
+ const syncer::Experiments& experiments) = 0;
+
+ // Called when the sync cycle returns there is an user actionable error.
+ virtual void OnActionableError(const syncer::SyncProtocolError& error) = 0;
+};
+
+} // namespace browser_sync
+
+#endif // COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_