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
3 // found in the LICENSE file.
5 #ifndef SYNC_NOTIFIER_PUSH_CLIENT_CHANNEL_H_
6 #define SYNC_NOTIFIER_PUSH_CLIENT_CHANNEL_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "jingle/notifier/listener/push_client_observer.h"
14 #include "sync/base/sync_export.h"
15 #include "sync/notifier/sync_system_resources.h"
19 } // namespace notifier
23 // A PushClientChannel is an implementation of NetworkChannel that
24 // routes messages through a PushClient.
25 class SYNC_EXPORT_PRIVATE PushClientChannel
26 : public SyncNetworkChannel
,
27 public NON_EXPORTED_BASE(notifier::PushClientObserver
) {
29 // |push_client| is guaranteed to be destroyed only when this object
31 explicit PushClientChannel(scoped_ptr
<notifier::PushClient
> push_client
);
33 virtual ~PushClientChannel();
35 // If not connected, connects with the given credentials. If
36 // already connected, the next connection attempt will use the given
38 virtual void UpdateCredentials(const std::string
& email
,
39 const std::string
& token
) OVERRIDE
;
41 // SyncNetworkChannel implementation.
42 virtual void SendEncodedMessage(const std::string
& encoded_message
) OVERRIDE
;
44 // notifier::PushClient::Observer implementation.
45 virtual void OnNotificationsEnabled() OVERRIDE
;
46 virtual void OnNotificationsDisabled(
47 notifier::NotificationsDisabledReason reason
) OVERRIDE
;
48 virtual void OnIncomingNotification(
49 const notifier::Notification
& notification
) OVERRIDE
;
52 scoped_ptr
<notifier::PushClient
> push_client_
;
54 DISALLOW_COPY_AND_ASSIGN(PushClientChannel
);
59 #endif // SYNC_NOTIFIER_PUSH_CLIENT_CHANNEL_H_