OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ |
6 #define CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ | 6 #define CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/invalidation/invalidation_logger.h" | 16 #include "chrome/browser/invalidation/invalidation_logger.h" |
17 #include "chrome/browser/invalidation/invalidation_service.h" | 17 #include "chrome/browser/invalidation/invalidation_service.h" |
18 #include "components/keyed_service/core/keyed_service.h" | 18 #include "components/keyed_service/core/keyed_service.h" |
19 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 19 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
20 #include "google_apis/gaia/identity_provider.h" | 20 #include "google_apis/gaia/identity_provider.h" |
21 #include "google_apis/gaia/oauth2_token_service.h" | 21 #include "google_apis/gaia/oauth2_token_service.h" |
22 #include "net/base/backoff_entry.h" | 22 #include "net/base/backoff_entry.h" |
23 #include "sync/notifier/invalidation_handler.h" | 23 #include "sync/notifier/invalidation_handler.h" |
24 #include "sync/notifier/invalidator_registrar.h" | 24 #include "sync/notifier/invalidator_registrar.h" |
25 | 25 |
26 class Profile; | 26 class Profile; |
27 | 27 |
| 28 namespace gcm { |
| 29 class GCMService; |
| 30 } |
| 31 |
28 namespace net { | 32 namespace net { |
29 class URLRequestContextGetter; | 33 class URLRequestContextGetter; |
30 } | 34 } |
31 | 35 |
32 namespace syncer { | 36 namespace syncer { |
33 class InvalidationStateTracker; | 37 class InvalidationStateTracker; |
34 class Invalidator; | 38 class Invalidator; |
35 } | 39 } |
36 | 40 |
37 namespace invalidation { | 41 namespace invalidation { |
(...skipping 12 matching lines...) Expand all Loading... |
50 PUSH_CLIENT_CHANNEL = 0, | 54 PUSH_CLIENT_CHANNEL = 0, |
51 GCM_NETWORK_CHANNEL = 1, | 55 GCM_NETWORK_CHANNEL = 1, |
52 | 56 |
53 // This enum is used in UMA_HISTOGRAM_ENUMERATION. Insert new values above | 57 // This enum is used in UMA_HISTOGRAM_ENUMERATION. Insert new values above |
54 // this line. | 58 // this line. |
55 NETWORK_CHANNELS_COUNT = 2 | 59 NETWORK_CHANNELS_COUNT = 2 |
56 }; | 60 }; |
57 | 61 |
58 TiclInvalidationService( | 62 TiclInvalidationService( |
59 scoped_ptr<IdentityProvider> identity_provider, | 63 scoped_ptr<IdentityProvider> identity_provider, |
| 64 gcm::GCMService* gcm_service, |
60 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 65 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
61 Profile* profile); | 66 Profile* profile); |
62 virtual ~TiclInvalidationService(); | 67 virtual ~TiclInvalidationService(); |
63 | 68 |
64 void Init( | 69 void Init( |
65 scoped_ptr<syncer::InvalidationStateTracker> invalidation_state_tracker); | 70 scoped_ptr<syncer::InvalidationStateTracker> invalidation_state_tracker); |
66 | 71 |
67 // InvalidationService implementation. | 72 // InvalidationService implementation. |
68 // It is an error to have registered handlers when Shutdown() is called. | 73 // It is an error to have registered handlers when Shutdown() is called. |
69 virtual void RegisterInvalidationHandler( | 74 virtual void RegisterInvalidationHandler( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 std::string access_token_; | 143 std::string access_token_; |
139 | 144 |
140 // TiclInvalidationService needs to hold reference to access_token_request_ | 145 // TiclInvalidationService needs to hold reference to access_token_request_ |
141 // for the duration of request in order to receive callbacks. | 146 // for the duration of request in order to receive callbacks. |
142 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 147 scoped_ptr<OAuth2TokenService::Request> access_token_request_; |
143 base::OneShotTimer<TiclInvalidationService> request_access_token_retry_timer_; | 148 base::OneShotTimer<TiclInvalidationService> request_access_token_retry_timer_; |
144 net::BackoffEntry request_access_token_backoff_; | 149 net::BackoffEntry request_access_token_backoff_; |
145 | 150 |
146 PrefChangeRegistrar pref_change_registrar_; | 151 PrefChangeRegistrar pref_change_registrar_; |
147 InvalidationNetworkChannel network_channel_type_; | 152 InvalidationNetworkChannel network_channel_type_; |
| 153 gcm::GCMService* gcm_service_; |
148 scoped_ptr<GCMInvalidationBridge> gcm_invalidation_bridge_; | 154 scoped_ptr<GCMInvalidationBridge> gcm_invalidation_bridge_; |
149 scoped_refptr<net::URLRequestContextGetter> request_context_; | 155 scoped_refptr<net::URLRequestContextGetter> request_context_; |
150 | 156 |
151 // The invalidation logger object we use to record state changes | 157 // The invalidation logger object we use to record state changes |
152 // and invalidations. | 158 // and invalidations. |
153 InvalidationLogger logger_; | 159 InvalidationLogger logger_; |
154 | 160 |
155 // Keep a copy of the important parameters used in network channel creation | 161 // Keep a copy of the important parameters used in network channel creation |
156 // for debugging. | 162 // for debugging. |
157 base::DictionaryValue network_channel_options_; | 163 base::DictionaryValue network_channel_options_; |
158 | 164 |
159 DISALLOW_COPY_AND_ASSIGN(TiclInvalidationService); | 165 DISALLOW_COPY_AND_ASSIGN(TiclInvalidationService); |
160 }; | 166 }; |
161 | 167 |
162 } // namespace invalidation | 168 } // namespace invalidation |
163 | 169 |
164 #endif // CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ | 170 #endif // CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_ |
OLD | NEW |