| 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_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 typedef base::Callback<void(bool update_received, | 35 typedef base::Callback<void(bool update_received, |
| 36 bool enabled, | 36 bool enabled, |
| 37 int poll_interval_seconds)> | 37 int poll_interval_seconds)> |
| 38 GCMChannelStatusRequestCallback; | 38 GCMChannelStatusRequestCallback; |
| 39 | 39 |
| 40 GCMChannelStatusRequest( | 40 GCMChannelStatusRequest( |
| 41 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 41 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| 42 const std::string& channel_status_request_url, | 42 const std::string& channel_status_request_url, |
| 43 const std::string& user_agent, | 43 const std::string& user_agent, |
| 44 const GCMChannelStatusRequestCallback& callback); | 44 const GCMChannelStatusRequestCallback& callback); |
| 45 virtual ~GCMChannelStatusRequest(); | 45 ~GCMChannelStatusRequest() override; |
| 46 | 46 |
| 47 void Start(); | 47 void Start(); |
| 48 | 48 |
| 49 static int default_poll_interval_seconds(); | 49 static int default_poll_interval_seconds(); |
| 50 static int min_poll_interval_seconds(); | 50 static int min_poll_interval_seconds(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 FRIEND_TEST_ALL_PREFIXES(GCMChannelStatusRequestTest, RequestData); | 53 FRIEND_TEST_ALL_PREFIXES(GCMChannelStatusRequestTest, RequestData); |
| 54 | 54 |
| 55 // Overridden from URLFetcherDelegate: | 55 // Overridden from URLFetcherDelegate: |
| 56 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 56 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 57 | 57 |
| 58 bool ParseResponse(const net::URLFetcher* source); | 58 bool ParseResponse(const net::URLFetcher* source); |
| 59 void RetryWithBackoff(bool update_backoff); | 59 void RetryWithBackoff(bool update_backoff); |
| 60 | 60 |
| 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 62 const std::string channel_status_request_url_; | 62 const std::string channel_status_request_url_; |
| 63 const std::string user_agent_; | 63 const std::string user_agent_; |
| 64 GCMChannelStatusRequestCallback callback_; | 64 GCMChannelStatusRequestCallback callback_; |
| 65 scoped_ptr<net::URLFetcher> url_fetcher_; | 65 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 66 net::BackoffEntry backoff_entry_; | 66 net::BackoffEntry backoff_entry_; |
| 67 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_; | 67 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest); | 69 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace gcm | 72 } // namespace gcm |
| 73 | 73 |
| 74 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ | 74 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ |
| OLD | NEW |