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

Side by Side Diff: chrome/browser/sync/glue/bridged_invalidator.h

Issue 12022041: Separate local and remote sync invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_BRIDGED_INVALIDATOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_BRIDGED_INVALIDATOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "sync/notifier/invalidator.h"
12
13 namespace browser_sync {
14
15 class ChromeSyncNotificationBridge;
16
17 // An Invalidator implementation that wraps a ChromeSyncNotificationBridge
18 // and optionally an Invalidator delegate (which it takes ownership of).
19 // All Invalidator calls are passed straight through to the delegate,
20 // with the exception of RegisterHandler, UpdateRegisteredIds, and
21 // UnregisterHandler, which result in the handler being registered, updated,
22 // and unregistered with the ChromeSyncNotificationBridge, respectively.
23 class BridgedInvalidator : public syncer::Invalidator {
24 public:
25 // Does not take ownership of |bridge|. Takes ownership of
26 // |delegate|. |delegate| may be NULL. |default_invalidator_state|
27 // is used by GetInvalidatorState() if |delegate| is NULL.
28 BridgedInvalidator(ChromeSyncNotificationBridge* bridge,
29 syncer::Invalidator* delegate,
30 syncer::InvalidatorState default_invalidator_state);
31 virtual ~BridgedInvalidator();
32
33 // Invalidator implementation. Passes through all calls to the delegate.
34 // RegisterHandler, UpdateRegisteredIds, and UnregisterHandler calls will
35 // also be forwarded to the bridge.
36 virtual void RegisterHandler(syncer::InvalidationHandler* handler) OVERRIDE;
37 virtual void UpdateRegisteredIds(syncer::InvalidationHandler * handler,
38 const syncer::ObjectIdSet& ids) OVERRIDE;
39 virtual void UnregisterHandler(syncer::InvalidationHandler* handler) OVERRIDE;
40 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
41 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
42 virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
43 virtual void UpdateCredentials(
44 const std::string& email, const std::string& token) OVERRIDE;
45 virtual void SendInvalidation(
46 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
47
48 private:
49 // The notification bridge that we register the observers with.
50 ChromeSyncNotificationBridge* const bridge_;
51
52 // The delegate we are wrapping.
53 const scoped_ptr<syncer::Invalidator> delegate_;
54
55 const syncer::InvalidatorState default_invalidator_state_;
56
57 DISALLOW_COPY_AND_ASSIGN(BridgedInvalidator);
58 };
59
60 } // namespace browser_sync
61
62 #endif // CHROME_BROWSER_SYNC_GLUE_BRIDGED_INVALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698