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 browser_sync { |
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 typedef base::Callback<void(const Result&)> ResultCallback; |
29 | 29 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // The current URLFetcher. Null unless a request is in progress. | 69 // The current URLFetcher. Null unless a request is in progress. |
70 std::unique_ptr<net::URLFetcher> fetcher_; | 70 std::unique_ptr<net::URLFetcher> fetcher_; |
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 browser_sync |
79 | 79 |
80 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ | 80 #endif // COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ |
OLD | NEW |