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

Unified Diff: sync/notifier/p2p_notifier.h

Issue 10388227: Revert 138216 - [Sync] Turn notifier::PushClient into an interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
===================================================================
--- sync/notifier/p2p_notifier.h (revision 138220)
+++ sync/notifier/p2p_notifier.h (working copy)
@@ -15,15 +15,19 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/threading/non_thread_safe.h"
-#include "jingle/notifier/listener/push_client_observer.h"
+#include "jingle/notifier/base/notifier_options.h"
+#include "jingle/notifier/listener/push_client.h"
#include "sync/notifier/sync_notifier.h"
#include "sync/syncable/model_type.h"
-namespace notifier {
-class PushClient;
-} // namespace notifier
+namespace base {
+class MessageLoopProxy;
+}
+namespace buzz {
+class XmppTaskParentInterface;
+} // namespace buzz
+
namespace sync_notifier {
// The channel to use for sync notifications.
@@ -82,14 +86,14 @@
class P2PNotifier
: public SyncNotifier,
- public notifier::PushClientObserver {
+ public notifier::PushClient::Observer {
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(scoped_ptr<notifier::PushClient> push_client,
+ P2PNotifier(const notifier::NotifierOptions& notifier_options,
P2PNotificationTarget send_notification_target);
virtual ~P2PNotifier();
@@ -106,23 +110,30 @@
virtual void SendNotification(
syncable::ModelTypeSet changed_types) OVERRIDE;
- // PushClientObserver implementation.
+ // PushClient::Delegate 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 push client.
- scoped_ptr<notifier::PushClient> push_client_;
+ // The XMPP push client.
+ notifier::PushClient push_client_;
// Our unique ID.
std::string unique_id_;
// Whether we have called UpdateCredentials() yet.
@@ -134,8 +145,8 @@
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