Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: sync/notifier/p2p_notifier.h

Issue 10413014: [Sync] Turn notifier::PushClient into an interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jingle/notifier/listener/xmpp_push_client_unittest.cc ('k') | sync/notifier/p2p_notifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/p2p_notifier.h
diff --git a/sync/notifier/p2p_notifier.h b/sync/notifier/p2p_notifier.h
index 24b0ab3a1b6a13f6e9c0437a754511bc1ac8d8c3..bc5ed6a38a34939ebf70d872ccd76a8dab6e9612 100644
--- a/sync/notifier/p2p_notifier.h
+++ b/sync/notifier/p2p_notifier.h
@@ -15,18 +15,14 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "jingle/notifier/base/notifier_options.h"
-#include "jingle/notifier/listener/push_client.h"
+#include "base/threading/non_thread_safe.h"
+#include "jingle/notifier/listener/push_client_observer.h"
#include "sync/notifier/sync_notifier.h"
#include "sync/syncable/model_type.h"
-namespace base {
-class MessageLoopProxy;
-}
-
-namespace buzz {
-class XmppTaskParentInterface;
-} // namespace buzz
+namespace notifier {
+class PushClient;
+} // namespace notifier
namespace sync_notifier {
@@ -86,14 +82,14 @@ class P2PNotificationData {
class P2PNotifier
: public SyncNotifier,
- public notifier::PushClient::Observer {
+ public notifier::PushClientObserver {
public:
// The |send_notification_target| parameter was added to allow us to send
// self-notifications in some cases, but not others. The value should be
// either NOTIFY_ALL to send notifications to all clients, or NOTIFY_OTHERS
// to send notifications to all clients except for the one that triggered the
// notification. See crbug.com/97780.
- P2PNotifier(const notifier::NotifierOptions& notifier_options,
+ P2PNotifier(scoped_ptr<notifier::PushClient> push_client,
P2PNotificationTarget send_notification_target);
virtual ~P2PNotifier();
@@ -110,30 +106,23 @@ class P2PNotifier
virtual void SendNotification(
syncable::ModelTypeSet changed_types) OVERRIDE;
- // PushClient::Delegate implementation.
+ // PushClientObserver implementation.
virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE;
virtual void OnIncomingNotification(
const notifier::Notification& notification) OVERRIDE;
- // For testing.
-
- void SimulateConnectForTest(
- base::WeakPtr<buzz::XmppTaskParentInterface> base_task);
-
- // Any notifications sent after this is called will be reflected,
- // i.e. will be treated as an incoming notification also.
- void ReflectSentNotificationsForTest();
-
void SendNotificationDataForTest(
const P2PNotificationData& notification_data);
private:
void SendNotificationData(const P2PNotificationData& notification_data);
+ base::NonThreadSafe non_thread_safe_;
+
ObserverList<SyncNotifierObserver> observer_list_;
- // The XMPP push client.
- notifier::PushClient push_client_;
+ // The push client.
+ scoped_ptr<notifier::PushClient> push_client_;
// Our unique ID.
std::string unique_id_;
// Whether we have called UpdateCredentials() yet.
@@ -145,8 +134,8 @@ class P2PNotifier
P2PNotificationTarget send_notification_target_;
syncable::ModelTypeSet enabled_types_;
- scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_;
};
} // namespace sync_notifier
+
#endif // SYNC_NOTIFIER_P2P_NOTIFIER_H_
« no previous file with comments | « jingle/notifier/listener/xmpp_push_client_unittest.cc ('k') | sync/notifier/p2p_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698