| 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/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "net/base/backoff_entry.h" | 15 #include "net/base/backoff_entry.h" |
| 15 #include "net/url_request/url_fetcher_delegate.h" | 16 #include "net/url_request/url_fetcher_delegate.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 const std::string& user_agent, | 43 const std::string& user_agent, |
| 43 const GCMChannelStatusRequestCallback& callback); | 44 const GCMChannelStatusRequestCallback& callback); |
| 44 virtual ~GCMChannelStatusRequest(); | 45 virtual ~GCMChannelStatusRequest(); |
| 45 | 46 |
| 46 void Start(); | 47 void Start(); |
| 47 | 48 |
| 48 static int default_poll_interval_seconds(); | 49 static int default_poll_interval_seconds(); |
| 49 static int min_poll_interval_seconds(); | 50 static int min_poll_interval_seconds(); |
| 50 | 51 |
| 51 private: | 52 private: |
| 53 FRIEND_TEST_ALL_PREFIXES(GCMChannelStatusRequestTest, RequestData); |
| 54 |
| 52 // Overridden from URLFetcherDelegate: | 55 // Overridden from URLFetcherDelegate: |
| 53 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 56 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 54 | 57 |
| 55 bool ParseResponse(const net::URLFetcher* source); | 58 bool ParseResponse(const net::URLFetcher* source); |
| 56 void RetryWithBackoff(bool update_backoff); | 59 void RetryWithBackoff(bool update_backoff); |
| 57 | 60 |
| 58 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 59 const std::string channel_status_request_url_; | 62 const std::string channel_status_request_url_; |
| 60 const std::string user_agent_; | 63 const std::string user_agent_; |
| 61 GCMChannelStatusRequestCallback callback_; | 64 GCMChannelStatusRequestCallback callback_; |
| 62 scoped_ptr<net::URLFetcher> url_fetcher_; | 65 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 63 net::BackoffEntry backoff_entry_; | 66 net::BackoffEntry backoff_entry_; |
| 64 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_; | 67 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_; |
| 65 | 68 |
| 66 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest); | 69 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest); |
| 67 }; | 70 }; |
| 68 | 71 |
| 69 } // namespace gcm | 72 } // namespace gcm |
| 70 | 73 |
| 71 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ | 74 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ |
| OLD | NEW |