Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 #include "base/threading/non_thread_safe.h" | |
| 6 #include "chrome/browser/invalidation/invalidation_frontend.h" | |
| 7 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 8 #include "sync/notifier/object_id_invalidation_map.h" | |
| 9 | |
| 10 #ifndef CHROME_BROWSER_INVALIDATION_P2P_INVALIDATION_SERVICE_H_ | |
| 11 #define CHROME_BROWSER_INVALIDATION_P2P_INVALIDATION_SERVICE_H_ | |
| 12 | |
| 13 namespace syncer { | |
| 14 class P2PInvalidator; | |
| 15 } | |
| 16 | |
| 17 class Profile; | |
| 18 | |
| 19 namespace invalidation { | |
| 20 | |
| 21 // This service is a wrapper around P2PInvalidator. Unlike other | |
| 22 // InvalidationServices, it can both send and receive invalidations. It is used | |
| 23 // only in tests, where we're unable to connect to a real invalidations server. | |
| 24 class P2PInvalidationService | |
| 25 : public base::NonThreadSafe, | |
| 26 public ProfileKeyedService, | |
| 27 public InvalidationFrontend { | |
| 28 public: | |
| 29 P2PInvalidationService(); | |
| 30 virtual ~P2PInvalidationService(); | |
| 31 | |
| 32 // Overrides ProfileKeyedService method. | |
| 33 virtual void Shutdown() OVERRIDE; | |
| 34 | |
| 35 // InvalidationFrontend implementation. | |
| 36 // It is an error to have registered handlers when Shutdown() is called. | |
| 37 virtual void RegisterInvalidationHandler( | |
| 38 syncer::InvalidationHandler* handler) OVERRIDE; | |
| 39 virtual void UpdateRegisteredInvalidationIds( | |
| 40 syncer::InvalidationHandler* handler, | |
| 41 const syncer::ObjectIdSet& ids) OVERRIDE; | |
| 42 virtual void UnregisterInvalidationHandler( | |
| 43 syncer::InvalidationHandler* handler) OVERRIDE; | |
| 44 virtual void AcknowledgeInvalidation( | |
| 45 const invalidation::ObjectId& id, | |
| 46 const syncer::AckHandle& ack_handle) OVERRIDE; | |
| 47 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; | |
| 48 virtual std::string GetInvalidatorClientId() const; | |
| 49 | |
| 50 void Init(Profile* profile); | |
| 51 void UpdateCredentials(const std::string& username, | |
| 52 const std::string& password); | |
| 53 | |
| 54 virtual void SendInvalidation( | |
| 55 const syncer::ObjectIdInvalidationMap& invalidation_map); | |
|
dcheng
2013/05/03 18:07:34
Does this need to be virtual? I don't think Invali
rlarocque
2013/05/03 22:16:14
You might be right. SendInvalidation() used to be
| |
| 56 | |
| 57 private: | |
| 58 scoped_ptr<syncer::P2PInvalidator> invalidator_; | |
| 59 std::string invalidator_id_; | |
|
tim (not reviewing)
2013/05/03 17:48:23
DISALLOW_COPY_AND_ASSIGN
rlarocque
2013/05/03 22:16:14
Done.
| |
| 60 }; | |
| 61 | |
| 62 } // namespace invalidation | |
| 63 | |
| 64 #endif // CHROME_BROWSER_INVALIDATION_P2P_INVALIDATION_SERVICE_H_ | |
| OLD | NEW |