OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ |
6 #define CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ | 6 #define CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/sync/notifier/invalidation_version_tracker.h" | 11 #include "chrome/browser/sync/notifier/invalidation_version_tracker.h" |
13 #include "chrome/browser/sync/util/weak_handle.h" | 12 #include "chrome/browser/sync/util/weak_handle.h" |
14 | 13 #include "jingle/notifier/base/notifier_options.h" |
15 class CommandLine; | |
16 | |
17 namespace net { | |
18 class URLRequestContextGetter; | |
19 } | |
20 | 14 |
21 namespace sync_notifier { | 15 namespace sync_notifier { |
22 | 16 |
23 class SyncNotifier; | 17 class SyncNotifier; |
24 | 18 |
25 // Class to instantiate various implementations of the SyncNotifier | 19 // Class to instantiate various implementations of the SyncNotifier |
26 // interface. | 20 // interface. |
27 class SyncNotifierFactory { | 21 class SyncNotifierFactory { |
28 public: | 22 public: |
29 // |client_info| is a string identifying the client, e.g. a user | 23 // |client_info| is a string identifying the client, e.g. a user |
30 // agent string. |invalidation_version_tracker| may be NULL (for | 24 // agent string. |invalidation_version_tracker| may be NULL (for |
31 // tests). | 25 // tests). |
32 SyncNotifierFactory( | 26 SyncNotifierFactory( |
| 27 const notifier::NotifierOptions& notifier_options, |
33 const std::string& client_info, | 28 const std::string& client_info, |
34 const scoped_refptr<net::URLRequestContextGetter>& | |
35 request_context_getter, | |
36 const base::WeakPtr<InvalidationVersionTracker>& | 29 const base::WeakPtr<InvalidationVersionTracker>& |
37 invalidation_version_tracker, | 30 invalidation_version_tracker); |
38 const CommandLine& command_line); | |
39 ~SyncNotifierFactory(); | 31 ~SyncNotifierFactory(); |
40 | 32 |
41 // Creates a sync notifier. Caller takes ownership of the returned | 33 // Creates a sync notifier. Caller takes ownership of the returned |
42 // object. However, the returned object must not outlive the | 34 // object. However, the returned object must not outlive the |
43 // factory from which it was created. Can be called on any thread. | 35 // factory from which it was created. Can be called on any thread. |
44 SyncNotifier* CreateSyncNotifier(); | 36 SyncNotifier* CreateSyncNotifier(); |
45 | 37 |
46 private: | 38 private: |
| 39 const notifier::NotifierOptions notifier_options_; |
47 const std::string client_info_; | 40 const std::string client_info_; |
48 const scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | |
49 const InvalidationVersionMap initial_max_invalidation_versions_; | 41 const InvalidationVersionMap initial_max_invalidation_versions_; |
50 const browser_sync::WeakHandle<InvalidationVersionTracker> | 42 const browser_sync::WeakHandle<InvalidationVersionTracker> |
51 invalidation_version_tracker_; | 43 invalidation_version_tracker_; |
52 const CommandLine& command_line_; | |
53 }; | 44 }; |
54 | 45 |
55 } // namespace sync_notifier | 46 } // namespace sync_notifier |
56 | 47 |
57 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ | 48 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_FACTORY_H_ |
OLD | NEW |