| OLD | NEW |
| (Empty) |
| 1 // Copyright 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 SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | |
| 6 #define SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "jingle/notifier/base/notifier_options.h" | |
| 12 #include "sync/base/sync_export.h" | |
| 13 #include "sync/internal_api/public/util/weak_handle.h" | |
| 14 #include "sync/notifier/invalidation_state_tracker.h" | |
| 15 | |
| 16 namespace syncer { | |
| 17 | |
| 18 class Invalidator; | |
| 19 | |
| 20 // Class to instantiate various implementations of the Invalidator | |
| 21 // interface. | |
| 22 class SYNC_EXPORT InvalidatorFactory { | |
| 23 public: | |
| 24 // |client_info| is a string identifying the client, e.g. a user | |
| 25 // agent string. |invalidation_state_tracker| may be NULL (for | |
| 26 // tests). | |
| 27 InvalidatorFactory( | |
| 28 const notifier::NotifierOptions& notifier_options, | |
| 29 const std::string& client_info, | |
| 30 const base::WeakPtr<InvalidationStateTracker>& | |
| 31 invalidation_state_tracker); | |
| 32 ~InvalidatorFactory(); | |
| 33 | |
| 34 // Creates an invalidator. Caller takes ownership of the returned | |
| 35 // object. However, the returned object must not outlive the | |
| 36 // factory from which it was created. Can be called on any thread. | |
| 37 Invalidator* CreateInvalidator(); | |
| 38 | |
| 39 // Returns the unique ID that was (or will be) passed to the invalidator. | |
| 40 std::string GetInvalidatorClientId() const; | |
| 41 | |
| 42 private: | |
| 43 const notifier::NotifierOptions notifier_options_; | |
| 44 | |
| 45 // Some of these should be const, but can't be set up in member initializers. | |
| 46 InvalidationStateMap initial_invalidation_state_map_; | |
| 47 const std::string client_info_; | |
| 48 std::string invalidator_client_id_; | |
| 49 std::string invalidation_bootstrap_data_; | |
| 50 WeakHandle<InvalidationStateTracker> invalidation_state_tracker_; | |
| 51 }; | |
| 52 | |
| 53 } // namespace syncer | |
| 54 | |
| 55 #endif // SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | |
| OLD | NEW |