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 "components/gcm_driver/gcm_channel_status_request.h" | 5 #include "components/gcm_driver/gcm_channel_status_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/gcm_driver/gcm_backoff_policy.h" | 9 #include "components/gcm_driver/gcm_backoff_policy.h" |
10 #include "components/gcm_driver/proto/gcm_channel_status.pb.h" | 10 #include "components/gcm_driver/proto/gcm_channel_status.pb.h" |
11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
13 #include "net/http/http_status_code.h" | 13 #include "net/http/http_status_code.h" |
14 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
15 #include "net/url_request/url_request_status.h" | 15 #include "net/url_request/url_request_status.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace gcm { | 18 namespace gcm { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const char kGCMChannelStatusRequestURL[] = | 22 const char kGCMChannelStatusRequestURL[] = |
23 "https://clients4.google.com/chrome-sync/command/"; | 23 "https://clients4.google.com/chrome-sync/command/"; |
24 const char kRequestContentType[] = "application/x-protobuf"; | 24 const char kRequestContentType[] = "application/octet-stream"; |
25 const char kGCMChannelTag[] = "gcm_channel"; | 25 const char kGCMChannelTag[] = "gcm_channel"; |
26 const int kDefaultPollIntervalSeconds = 60 * 60; // 60 minutes. | 26 const int kDefaultPollIntervalSeconds = 60 * 60; // 60 minutes. |
27 const int kMinPollIntervalSeconds = 30 * 60; // 30 minutes. | 27 const int kMinPollIntervalSeconds = 30 * 60; // 30 minutes. |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 GCMChannelStatusRequest::GCMChannelStatusRequest( | 31 GCMChannelStatusRequest::GCMChannelStatusRequest( |
32 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 32 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
33 const GCMChannelStatusRequestCallback& callback) | 33 const GCMChannelStatusRequestCallback& callback) |
34 : request_context_getter_(request_context_getter), | 34 : request_context_getter_(request_context_getter), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 weak_ptr_factory_.GetWeakPtr(), | 137 weak_ptr_factory_.GetWeakPtr(), |
138 false), | 138 false), |
139 backoff_entry_.GetTimeUntilRelease()); | 139 backoff_entry_.GetTimeUntilRelease()); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 Start(); | 143 Start(); |
144 } | 144 } |
145 | 145 |
146 } // namespace gcm | 146 } // namespace gcm |
OLD | NEW |