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 #include "components/sync/driver/sync_stopped_reporter.h" | 5 #include "components/sync/driver/sync_stopped_reporter.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const char kEventEndpoint[] = "event"; | 21 const char kEventEndpoint[] = "event"; |
22 | 22 |
23 // The request is tiny, so even on poor connections 10 seconds should be | 23 // The request is tiny, so even on poor connections 10 seconds should be |
24 // plenty of time. Since sync is off when this request is started, we don't | 24 // plenty of time. Since sync is off when this request is started, we don't |
25 // want anything sync-related hanging around for very long from a human | 25 // want anything sync-related hanging around for very long from a human |
26 // perspective either. This seems like a good compromise. | 26 // perspective either. This seems like a good compromise. |
27 const int kRequestTimeoutSeconds = 10; | 27 const int kRequestTimeoutSeconds = 10; |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 namespace browser_sync { | 31 namespace syncer { |
32 | 32 |
33 SyncStoppedReporter::SyncStoppedReporter( | 33 SyncStoppedReporter::SyncStoppedReporter( |
34 const GURL& sync_service_url, | 34 const GURL& sync_service_url, |
35 const std::string& user_agent, | 35 const std::string& user_agent, |
36 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 36 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
37 const ResultCallback& callback) | 37 const ResultCallback& callback) |
38 : sync_event_url_(GetSyncEventURL(sync_service_url)), | 38 : sync_event_url_(GetSyncEventURL(sync_service_url)), |
39 user_agent_(user_agent), | 39 user_agent_(user_agent), |
40 request_context_(request_context), | 40 request_context_(request_context), |
41 callback_(callback) { | 41 callback_(callback) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 GURL::Replacements replacements; | 109 GURL::Replacements replacements; |
110 replacements.SetPathStr(path); | 110 replacements.SetPathStr(path); |
111 return sync_service_url.ReplaceComponents(replacements); | 111 return sync_service_url.ReplaceComponents(replacements); |
112 } | 112 } |
113 | 113 |
114 void SyncStoppedReporter::SetTimerTaskRunnerForTest( | 114 void SyncStoppedReporter::SetTimerTaskRunnerForTest( |
115 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 115 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
116 timer_.SetTaskRunner(task_runner); | 116 timer_.SetTaskRunner(task_runner); |
117 } | 117 } |
118 | 118 |
119 } // namespace browser_sync | 119 } // namespace syncer |
OLD | NEW |