| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 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 // A simple wrapper around invalidation::InvalidationClient that |
| 6 // handles all the startup/shutdown details and hookups. |
| 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| 9 #define CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| 10 |
| 11 #include <string> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/non_thread_safe.h" |
| 15 #include "base/scoped_ptr.h" |
| 16 #include "chrome/browser/sync/notifier/chrome_system_resources.h" |
| 17 #include "google/cacheinvalidation/invalidation-client.h" |
| 18 |
| 19 namespace buzz { |
| 20 class XmppClient; |
| 21 } // namespace |
| 22 |
| 23 namespace sync_notifier { |
| 24 |
| 25 class CacheInvalidationPacketHandler; |
| 26 |
| 27 // TODO(akalin): Hook this up to a NetworkChangeNotifier so we can |
| 28 // properly notify invalidation_client_. |
| 29 |
| 30 class ChromeInvalidationClient { |
| 31 public: |
| 32 ChromeInvalidationClient(); |
| 33 |
| 34 ~ChromeInvalidationClient(); |
| 35 |
| 36 // Does not take ownership of |listener| nor |xmpp_client|. |
| 37 void Start( |
| 38 const std::string& app_name, |
| 39 invalidation::InvalidationListener* listener, |
| 40 buzz::XmppClient* xmpp_client); |
| 41 |
| 42 void Stop(); |
| 43 |
| 44 // The following functions must only be called between calls to |
| 45 // Start() and Stop(). See invalidation-client.h for documentation. |
| 46 |
| 47 void Register(const invalidation::ObjectId& oid, |
| 48 invalidation::RegistrationCallback* callback); |
| 49 |
| 50 void Unregister(const invalidation::ObjectId& oid, |
| 51 invalidation::RegistrationCallback* callback); |
| 52 |
| 53 private: |
| 54 NonThreadSafe non_thread_safe_; |
| 55 ChromeSystemResources chrome_system_resources_; |
| 56 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; |
| 57 scoped_ptr<CacheInvalidationPacketHandler> |
| 58 cache_invalidation_packet_handler_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); |
| 61 }; |
| 62 |
| 63 } // namespace sync_notifier |
| 64 |
| 65 #endif // CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| OLD | NEW |