diff options
| author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 07:45:26 +0000 |
|---|---|---|
| committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 07:45:26 +0000 |
| commit | 3fd7d7ca4dd5d484c541ff4983e3e83d0917baee (patch) | |
| tree | e60c62e38a109e6b20aae5cc3e887cd44b31c034 /chrome/browser/sync/glue/bridged_sync_notifier.h | |
| parent | f8c3aead7e7812724f1c21bb697464aca0edd89b (diff) | |
| download | chromium_src-3fd7d7ca4dd5d484c541ff4983e3e83d0917baee.zip chromium_src-3fd7d7ca4dd5d484c541ff4983e3e83d0917baee.tar.gz chromium_src-3fd7d7ca4dd5d484c541ff4983e3e83d0917baee.tar.bz2 | |
[Sync] Move BridgedSyncNotifier and ChromeSyncNotificationBridge to glue/
sync_notifier isn't supposed to have dependencies on chrome.
BUG=113723
TEST=
Review URL: https://chromiumcodereview.appspot.com/9512005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue/bridged_sync_notifier.h')
| -rw-r--r-- | chrome/browser/sync/glue/bridged_sync_notifier.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/sync/glue/bridged_sync_notifier.h b/chrome/browser/sync/glue/bridged_sync_notifier.h new file mode 100644 index 0000000..d758597 --- /dev/null +++ b/chrome/browser/sync/glue/bridged_sync_notifier.h @@ -0,0 +1,54 @@ +// Copyright (c) 2012 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 CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ +#define CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/sync/notifier/sync_notifier.h" + +namespace browser_sync { + +class ChromeSyncNotificationBridge; + +// A SyncNotifier implementation that wraps a ChromeSyncNotificationBridge +// and a SyncNotifier delegate (which it takes ownership of). All SyncNotifier +// calls are passed straight through to the delegate, with the exception of +// AddObserver/RemoveObserver, which also result in the observer being +// registered/deregistered with the ChromeSyncNotificationBridge. +class BridgedSyncNotifier : public sync_notifier::SyncNotifier { + public: + // Does not take ownership of |bridge|. Takes ownership of |delegate|. + BridgedSyncNotifier(ChromeSyncNotificationBridge* bridge, + sync_notifier::SyncNotifier* delegate); + virtual ~BridgedSyncNotifier(); + + // SyncNotifier implementation. Passes through all calls to the delegate. + // AddObserver/RemoveObserver will also register/deregister |observer| with + // the bridge. + virtual void AddObserver( + sync_notifier::SyncNotifierObserver* observer) OVERRIDE; + virtual void RemoveObserver( + sync_notifier::SyncNotifierObserver* observer) OVERRIDE; + virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; + virtual void SetState(const std::string& state) OVERRIDE; + virtual void UpdateCredentials( + const std::string& email, const std::string& token) OVERRIDE; + virtual void UpdateEnabledTypes( + syncable::ModelTypeSet enabled_types) OVERRIDE; + virtual void SendNotification( + syncable::ModelTypeSet changed_types) OVERRIDE; + + private: + // The notification bridge that we register the observers with. + ChromeSyncNotificationBridge* bridge_; + + // The delegate we are wrapping. + scoped_ptr<sync_notifier::SyncNotifier> delegate_; +}; + +} // namespace browser_sync + +#endif // CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
