| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | 5 #ifndef SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ |
| 6 #define SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | 6 #define SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "jingle/notifier/base/notifier_options.h" | 11 #include "jingle/notifier/base/notifier_options.h" |
| 12 #include "sync/base/sync_export.h" |
| 12 #include "sync/internal_api/public/util/weak_handle.h" | 13 #include "sync/internal_api/public/util/weak_handle.h" |
| 13 #include "sync/notifier/invalidation_state_tracker.h" | 14 #include "sync/notifier/invalidation_state_tracker.h" |
| 14 | 15 |
| 15 namespace syncer { | 16 namespace syncer { |
| 16 | 17 |
| 17 class Invalidator; | 18 class Invalidator; |
| 18 | 19 |
| 19 // Class to instantiate various implementations of the Invalidator | 20 // Class to instantiate various implementations of the Invalidator |
| 20 // interface. | 21 // interface. |
| 21 class InvalidatorFactory { | 22 class SYNC_EXPORT InvalidatorFactory { |
| 22 public: | 23 public: |
| 23 // |client_info| is a string identifying the client, e.g. a user | 24 // |client_info| is a string identifying the client, e.g. a user |
| 24 // agent string. |invalidation_state_tracker| may be NULL (for | 25 // agent string. |invalidation_state_tracker| may be NULL (for |
| 25 // tests). | 26 // tests). |
| 26 InvalidatorFactory( | 27 InvalidatorFactory( |
| 27 const notifier::NotifierOptions& notifier_options, | 28 const notifier::NotifierOptions& notifier_options, |
| 28 const std::string& client_info, | 29 const std::string& client_info, |
| 29 const base::WeakPtr<InvalidationStateTracker>& | 30 const base::WeakPtr<InvalidationStateTracker>& |
| 30 invalidation_state_tracker); | 31 invalidation_state_tracker); |
| 31 ~InvalidatorFactory(); | 32 ~InvalidatorFactory(); |
| 32 | 33 |
| 33 // Creates an invalidator. Caller takes ownership of the returned | 34 // Creates an invalidator. Caller takes ownership of the returned |
| 34 // object. However, the returned object must not outlive the | 35 // object. However, the returned object must not outlive the |
| 35 // factory from which it was created. Can be called on any thread. | 36 // factory from which it was created. Can be called on any thread. |
| 36 Invalidator* CreateInvalidator(); | 37 Invalidator* CreateInvalidator(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 const notifier::NotifierOptions notifier_options_; | 40 const notifier::NotifierOptions notifier_options_; |
| 40 const std::string client_info_; | 41 const std::string client_info_; |
| 41 const InvalidationStateMap initial_invalidation_state_map_; | 42 const InvalidationStateMap initial_invalidation_state_map_; |
| 42 const std::string invalidation_bootstrap_data_; | 43 const std::string invalidation_bootstrap_data_; |
| 43 const WeakHandle<InvalidationStateTracker> | 44 const WeakHandle<InvalidationStateTracker> |
| 44 invalidation_state_tracker_; | 45 invalidation_state_tracker_; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace syncer | 48 } // namespace syncer |
| 48 | 49 |
| 49 #endif // SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ | 50 #endif // SYNC_NOTIFIER_INVALIDATOR_FACTORY_H_ |
| OLD | NEW |