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/profiles/profile_keyed_service.h" |
| 7 #include "chrome/browser/sync/invalidation_frontend.h" |
| 8 #include "sync/notifier/object_id_invalidation_map.h" |
| 9 |
| 10 #ifndef CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_ |
| 11 #define CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_ |
| 12 |
| 13 namespace syncer { |
| 14 class P2PInvalidator; |
| 15 } |
| 16 |
| 17 class Profile; |
| 18 |
| 19 // A wrapper around P2PInvalidator. |
| 20 class P2PInvalidationService |
| 21 : public base::NonThreadSafe, |
| 22 public ProfileKeyedService, |
| 23 public InvalidationFrontend { |
| 24 public: |
| 25 P2PInvalidationService(); |
| 26 virtual ~P2PInvalidationService(); |
| 27 |
| 28 // Overrides ProfileKeyedService method. |
| 29 virtual void Shutdown() OVERRIDE; |
| 30 |
| 31 // InvalidationFrontend implementation. |
| 32 // It is an error to have registered handlers when Shutdown() is called. |
| 33 virtual void RegisterInvalidationHandler( |
| 34 syncer::InvalidationHandler* handler) OVERRIDE; |
| 35 virtual void UpdateRegisteredInvalidationIds( |
| 36 syncer::InvalidationHandler* handler, |
| 37 const syncer::ObjectIdSet& ids) OVERRIDE; |
| 38 virtual void UnregisterInvalidationHandler( |
| 39 syncer::InvalidationHandler* handler) OVERRIDE; |
| 40 virtual void AcknowledgeInvalidation( |
| 41 const invalidation::ObjectId& id, |
| 42 const syncer::AckHandle& ack_handle) OVERRIDE; |
| 43 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 44 virtual std::string GetInvalidatorClientId() const OVERRIDE; |
| 45 |
| 46 void Init(Profile* profile); |
| 47 void UpdateCredentials(const std::string& username, |
| 48 const std::string& password); |
| 49 |
| 50 virtual void SendInvalidation( |
| 51 const syncer::ObjectIdInvalidationMap& invalidation_map); |
| 52 |
| 53 private: |
| 54 scoped_ptr<syncer::P2PInvalidator> invalidator_; |
| 55 std::string invalidator_id_; |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_ |
OLD | NEW |