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 #include "google_apis/gaia/google_service_auth_error.h" | 5 #include "google_apis/gaia/google_service_auth_error.h" |
6 #include "net/http/http_status_code.h" | 6 #include "net/http/http_status_code.h" |
7 #include "net/url_request/url_fetcher.h" | 7 #include "net/url_request/url_fetcher.h" |
8 #include "net/url_request/url_request_status.h" | 8 #include "net/url_request/url_request_status.h" |
9 #include "sync/notifier/gcm_network_channel.h" | 9 #include "sync/notifier/gcm_network_channel.h" |
10 #include "sync/notifier/gcm_network_channel_delegate.h" | 10 #include "sync/notifier/gcm_network_channel_delegate.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 GCMNetworkChannel::GCMNetworkChannel( | 45 GCMNetworkChannel::GCMNetworkChannel( |
46 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 46 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
47 scoped_ptr<GCMNetworkChannelDelegate> delegate) | 47 scoped_ptr<GCMNetworkChannelDelegate> delegate) |
48 : request_context_getter_(request_context_getter), | 48 : request_context_getter_(request_context_getter), |
49 delegate_(delegate.Pass()), | 49 delegate_(delegate.Pass()), |
50 register_backoff_entry_(new net::BackoffEntry(&kRegisterBackoffPolicy)), | 50 register_backoff_entry_(new net::BackoffEntry(&kRegisterBackoffPolicy)), |
51 weak_factory_(this) { | 51 weak_factory_(this) { |
| 52 delegate_->Initialize(); |
52 Register(); | 53 Register(); |
53 } | 54 } |
54 | 55 |
55 GCMNetworkChannel::~GCMNetworkChannel() { | 56 GCMNetworkChannel::~GCMNetworkChannel() { |
56 } | 57 } |
57 | 58 |
58 void GCMNetworkChannel::UpdateCredentials( | 59 void GCMNetworkChannel::UpdateCredentials( |
59 const std::string& email, | 60 const std::string& email, |
60 const std::string& token) { | 61 const std::string& token) { |
61 // Do nothing. We get access token by requesting it for every message. | 62 // Do nothing. We get access token by requesting it for every message. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 GURL GCMNetworkChannel::BuildUrl() { | 178 GURL GCMNetworkChannel::BuildUrl() { |
178 DCHECK(!registration_id_.empty()); | 179 DCHECK(!registration_id_.empty()); |
179 // Prepare NetworkEndpointId using registration_id | 180 // Prepare NetworkEndpointId using registration_id |
180 // Serialize NetworkEndpointId into byte array and base64 encode. | 181 // Serialize NetworkEndpointId into byte array and base64 encode. |
181 // Format url using encoded NetworkEndpointId. | 182 // Format url using encoded NetworkEndpointId. |
182 // TODO(pavely): implement all of the above. | 183 // TODO(pavely): implement all of the above. |
183 return GURL("http://invalid.url.com"); | 184 return GURL("http://invalid.url.com"); |
184 } | 185 } |
185 | 186 |
186 } // namespace syncer | 187 } // namespace syncer |
OLD | NEW |