| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Inform the sync server that sync was stopped on this device. | 37 // Inform the sync server that sync was stopped on this device. |
| 38 // |access_token|, |cache_guid|, and |birthday| must not be empty. | 38 // |access_token|, |cache_guid|, and |birthday| must not be empty. |
| 39 void ReportSyncStopped(const std::string& access_token, | 39 void ReportSyncStopped(const std::string& access_token, |
| 40 const std::string& cache_guid, | 40 const std::string& cache_guid, |
| 41 const std::string& birthday); | 41 const std::string& birthday); |
| 42 | 42 |
| 43 // net::URLFetcherDelegate implementation. | 43 // net::URLFetcherDelegate implementation. |
| 44 void OnURLFetchComplete(const net::URLFetcher* source) override; | 44 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 45 | 45 |
| 46 // Override the timer's task runner so it can be triggered in tests. | |
| 47 void SetTimerTaskRunnerForTest( | |
| 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | |
| 49 | |
| 50 private: | 46 private: |
| 51 // Convert the base sync URL into the sync event URL. | 47 // Convert the base sync URL into the sync event URL. |
| 52 static GURL GetSyncEventURL(const GURL& sync_service_url); | 48 static GURL GetSyncEventURL(const GURL& sync_service_url); |
| 53 | 49 |
| 54 // Callback for a request timing out. | 50 // Callback for a request timing out. |
| 55 void OnTimeout(); | 51 void OnTimeout(); |
| 56 | 52 |
| 57 // Handles timing out requests. | 53 // Handles timing out requests. |
| 58 base::OneShotTimer timer_; | 54 base::OneShotTimer timer_; |
| 59 | 55 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 | 67 |
| 72 // A callback for request completion or timeout. | 68 // A callback for request completion or timeout. |
| 73 ResultCallback callback_; | 69 ResultCallback callback_; |
| 74 | 70 |
| 75 DISALLOW_COPY_AND_ASSIGN(SyncStoppedReporter); | 71 DISALLOW_COPY_AND_ASSIGN(SyncStoppedReporter); |
| 76 }; | 72 }; |
| 77 | 73 |
| 78 } // namespace syncer | 74 } // namespace syncer |
| 79 | 75 |
| 80 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ | 76 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ |
| OLD | NEW |