| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" |
| 10 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
| 15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/policy/system_log_uploader.h" | 17 #include "chrome/browser/chromeos/policy/system_log_uploader.h" |
| 17 #include "chrome/browser/chromeos/policy/upload_job_impl.h" | 18 #include "chrome/browser/chromeos/policy/upload_job_impl.h" |
| 18 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 19 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 19 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 20 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 std::string GetUploadUrl() { | 160 std::string GetUploadUrl() { |
| 160 return policy::BrowserPolicyConnector::GetDeviceManagementUrl() + | 161 return policy::BrowserPolicyConnector::GetDeviceManagementUrl() + |
| 161 kSystemLogUploadUrlTail; | 162 kSystemLogUploadUrlTail; |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace | 165 } // namespace |
| 165 | 166 |
| 166 namespace policy { | 167 namespace policy { |
| 167 | 168 |
| 168 // Determines the time between log uploads. | 169 // Determines the time between log uploads. |
| 169 const int64 SystemLogUploader::kDefaultUploadDelayMs = | 170 const int64_t SystemLogUploader::kDefaultUploadDelayMs = |
| 170 12 * 60 * 60 * 1000; // 12 hours | 171 12 * 60 * 60 * 1000; // 12 hours |
| 171 | 172 |
| 172 // Determines the time, measured from the time of last failed upload, | 173 // Determines the time, measured from the time of last failed upload, |
| 173 // after which the log upload is retried. | 174 // after which the log upload is retried. |
| 174 const int64 SystemLogUploader::kErrorUploadDelayMs = 120 * 1000; // 120 seconds | 175 const int64_t SystemLogUploader::kErrorUploadDelayMs = |
| 176 120 * 1000; // 120 seconds |
| 175 | 177 |
| 176 // String constant identifying the header field which stores the file type. | 178 // String constant identifying the header field which stores the file type. |
| 177 const char* const SystemLogUploader::kFileTypeHeaderName = "File-Type"; | 179 const char* const SystemLogUploader::kFileTypeHeaderName = "File-Type"; |
| 178 | 180 |
| 179 // String constant signalling that the data segment contains log files. | 181 // String constant signalling that the data segment contains log files. |
| 180 const char* const SystemLogUploader::kFileTypeLogFile = "log_file"; | 182 const char* const SystemLogUploader::kFileTypeLogFile = "log_file"; |
| 181 | 183 |
| 182 // String constant signalling that the segment contains a plain text. | 184 // String constant signalling that the segment contains a plain text. |
| 183 const char* const SystemLogUploader::kContentTypePlainText = "text/plain"; | 185 const char* const SystemLogUploader::kContentTypePlainText = "text/plain"; |
| 184 | 186 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 base::TimeDelta()); | 354 base::TimeDelta()); |
| 353 // Ensure that we never have more than one pending delayed task. | 355 // Ensure that we never have more than one pending delayed task. |
| 354 weak_factory_.InvalidateWeakPtrs(); | 356 weak_factory_.InvalidateWeakPtrs(); |
| 355 task_runner_->PostDelayedTask(FROM_HERE, | 357 task_runner_->PostDelayedTask(FROM_HERE, |
| 356 base::Bind(&SystemLogUploader::StartLogUpload, | 358 base::Bind(&SystemLogUploader::StartLogUpload, |
| 357 weak_factory_.GetWeakPtr()), | 359 weak_factory_.GetWeakPtr()), |
| 358 delay); | 360 delay); |
| 359 } | 361 } |
| 360 | 362 |
| 361 } // namespace policy | 363 } // namespace policy |
| OLD | NEW |