Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: components/gcm_driver/gcm_channel_status_request.h

Issue 561943002: Reland: Add GCMChannelStatusSyncer to schedule requests and enable/disable GCM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOS test failures Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/gcm_driver/DEPS ('k') | components/gcm_driver/gcm_channel_status_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macros.h" 10 #include "base/macros.h"
(...skipping 18 matching lines...) Expand all
29 typedef base::Callback<void(bool enabled, int poll_interval_seconds)> 29 typedef base::Callback<void(bool enabled, int poll_interval_seconds)>
30 GCMChannelStatusRequestCallback; 30 GCMChannelStatusRequestCallback;
31 31
32 GCMChannelStatusRequest( 32 GCMChannelStatusRequest(
33 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, 33 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
34 const GCMChannelStatusRequestCallback& callback); 34 const GCMChannelStatusRequestCallback& callback);
35 virtual ~GCMChannelStatusRequest(); 35 virtual ~GCMChannelStatusRequest();
36 36
37 void Start(); 37 void Start();
38 38
39 // Exposed for testing purpose. 39 static int default_poll_interval_seconds();
40 static int default_poll_interval_seconds_for_testing(); 40 static int min_poll_interval_seconds();
41 static int min_poll_interval_seconds_for_testing();
42 41
43 private: 42 private:
44 // Overridden from URLFetcherDelegate: 43 // Overridden from URLFetcherDelegate:
45 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 44 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
46 45
47 bool ParseResponse(const net::URLFetcher* source); 46 bool ParseResponse(const net::URLFetcher* source);
48 void RetryWithBackoff(bool update_backoff); 47 void RetryWithBackoff(bool update_backoff);
49 48
50 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 49 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
51 GCMChannelStatusRequestCallback callback_; 50 GCMChannelStatusRequestCallback callback_;
52 scoped_ptr<net::URLFetcher> url_fetcher_; 51 scoped_ptr<net::URLFetcher> url_fetcher_;
53 net::BackoffEntry backoff_entry_; 52 net::BackoffEntry backoff_entry_;
54 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_; 53 base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_;
55 54
56 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest); 55 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusRequest);
57 }; 56 };
58 57
59 } // namespace gcm 58 } // namespace gcm
60 59
61 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_ 60 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_
OLDNEW
« no previous file with comments | « components/gcm_driver/DEPS ('k') | components/gcm_driver/gcm_channel_status_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698