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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
15 #include "net/url_request/url_fetcher_delegate.h" | 15 #include "net/url_request/url_fetcher_delegate.h" |
16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace syncer { | 19 namespace syncer { |
20 | 20 |
21 // Manages informing the sync server that sync has been disabled. | 21 // Manages informing the sync server that sync has been disabled. |
22 // An implementation of URLFetcherDelegate was needed in order to | 22 // An implementation of URLFetcherDelegate was needed in order to |
23 // clean up the fetcher_ pointer when the request completes. | 23 // clean up the fetcher_ pointer when the request completes. |
24 class SyncStoppedReporter : public net::URLFetcherDelegate { | 24 class SyncStoppedReporter : public net::URLFetcherDelegate { |
25 public: | 25 public: |
26 enum Result { RESULT_SUCCESS, RESULT_ERROR, RESULT_TIMEOUT }; | 26 enum Result { RESULT_SUCCESS, RESULT_ERROR, RESULT_TIMEOUT }; |
27 | 27 |
28 typedef base::Callback<void(const Result&)> ResultCallback; | 28 using ResultCallback = base::Callback<void(const Result&)>; |
29 | 29 |
30 SyncStoppedReporter( | 30 SyncStoppedReporter( |
31 const GURL& sync_service_url, | 31 const GURL& sync_service_url, |
32 const std::string& user_agent, | 32 const std::string& user_agent, |
33 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 33 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
34 const ResultCallback& callback); | 34 const ResultCallback& callback); |
35 ~SyncStoppedReporter() override; | 35 ~SyncStoppedReporter() override; |
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. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // A callback for request completion or timeout. | 72 // A callback for request completion or timeout. |
73 ResultCallback callback_; | 73 ResultCallback callback_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(SyncStoppedReporter); | 75 DISALLOW_COPY_AND_ASSIGN(SyncStoppedReporter); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace syncer | 78 } // namespace syncer |
79 | 79 |
80 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ | 80 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ |
OLD | NEW |