OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ | 5 #ifndef COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ |
6 #define COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ | 6 #define COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // them. | 34 // them. |
35 class GCMInvalidationBridge : public gcm::GCMAppHandler, | 35 class GCMInvalidationBridge : public gcm::GCMAppHandler, |
36 public gcm::GCMConnectionObserver, | 36 public gcm::GCMConnectionObserver, |
37 public OAuth2TokenService::Consumer, | 37 public OAuth2TokenService::Consumer, |
38 public base::NonThreadSafe { | 38 public base::NonThreadSafe { |
39 public: | 39 public: |
40 class Core; | 40 class Core; |
41 | 41 |
42 GCMInvalidationBridge(gcm::GCMDriver* gcm_driver, | 42 GCMInvalidationBridge(gcm::GCMDriver* gcm_driver, |
43 IdentityProvider* identity_provider); | 43 IdentityProvider* identity_provider); |
44 virtual ~GCMInvalidationBridge(); | 44 ~GCMInvalidationBridge() override; |
45 | 45 |
46 // OAuth2TokenService::Consumer implementation. | 46 // OAuth2TokenService::Consumer implementation. |
47 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 47 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
48 const std::string& access_token, | 48 const std::string& access_token, |
49 const base::Time& expiration_time) override; | 49 const base::Time& expiration_time) override; |
50 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 50 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
51 const GoogleServiceAuthError& error) override; | 51 const GoogleServiceAuthError& error) override; |
52 | 52 |
53 // gcm::GCMAppHandler implementation. | 53 // gcm::GCMAppHandler implementation. |
54 virtual void ShutdownHandler() override; | 54 void ShutdownHandler() override; |
55 virtual void OnMessage( | 55 void OnMessage(const std::string& app_id, |
56 const std::string& app_id, | 56 const gcm::GCMClient::IncomingMessage& message) override; |
57 const gcm::GCMClient::IncomingMessage& message) override; | 57 void OnMessagesDeleted(const std::string& app_id) override; |
58 virtual void OnMessagesDeleted(const std::string& app_id) override; | 58 void OnSendError( |
59 virtual void OnSendError( | |
60 const std::string& app_id, | 59 const std::string& app_id, |
61 const gcm::GCMClient::SendErrorDetails& send_error_details) override; | 60 const gcm::GCMClient::SendErrorDetails& send_error_details) override; |
62 virtual void OnSendAcknowledged(const std::string& app_id, | 61 void OnSendAcknowledged(const std::string& app_id, |
63 const std::string& message_id) override; | 62 const std::string& message_id) override; |
64 | 63 |
65 // gcm::GCMConnectionObserver implementation. | 64 // gcm::GCMConnectionObserver implementation. |
66 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) override; | 65 void OnConnected(const net::IPEndPoint& ip_endpoint) override; |
67 virtual void OnDisconnected() override; | 66 void OnDisconnected() override; |
68 | 67 |
69 scoped_ptr<syncer::GCMNetworkChannelDelegate> CreateDelegate(); | 68 scoped_ptr<syncer::GCMNetworkChannelDelegate> CreateDelegate(); |
70 | 69 |
71 void CoreInitializationDone( | 70 void CoreInitializationDone( |
72 base::WeakPtr<Core> core, | 71 base::WeakPtr<Core> core, |
73 scoped_refptr<base::SingleThreadTaskRunner> core_thread_task_runner); | 72 scoped_refptr<base::SingleThreadTaskRunner> core_thread_task_runner); |
74 | 73 |
75 // Functions reflecting GCMNetworkChannelDelegate interface. These are called | 74 // Functions reflecting GCMNetworkChannelDelegate interface. These are called |
76 // on UI thread to perform actual work. | 75 // on UI thread to perform actual work. |
77 void RequestToken( | 76 void RequestToken( |
(...skipping 23 matching lines...) Expand all Loading... |
101 bool subscribed_for_incoming_messages_; | 100 bool subscribed_for_incoming_messages_; |
102 | 101 |
103 base::WeakPtrFactory<GCMInvalidationBridge> weak_factory_; | 102 base::WeakPtrFactory<GCMInvalidationBridge> weak_factory_; |
104 | 103 |
105 DISALLOW_COPY_AND_ASSIGN(GCMInvalidationBridge); | 104 DISALLOW_COPY_AND_ASSIGN(GCMInvalidationBridge); |
106 }; | 105 }; |
107 | 106 |
108 } // namespace invalidation | 107 } // namespace invalidation |
109 | 108 |
110 #endif // COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ | 109 #endif // COMPONENTS_INVALIDATION_GCM_INVALIDATION_BRIDGE_H_ |
OLD | NEW |