| 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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/chromeos/policy/system_log_upload_job.h" | 11 #include "chrome/browser/chromeos/policy/system_log_upload_job.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "net/http/http_request_headers.h" | 13 #include "net/http/http_request_headers.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 // String constant defining the upload url. | 16 // String constant defining the upload url. |
| 17 const char* kDefaultUploadUrl = | 17 const char* kDefaultUploadUrl = |
| 18 "https://m.google.com/devicemanagement/data/api/upload"; | 18 "https://m.google.com/devicemanagement/data/api/upload"; |
| 19 | |
| 20 // String constant identifying the header field which stores the file type. | |
| 21 const char* kFileTypeHeaderName = "File-Type"; | |
| 22 | |
| 23 // String constant signalling that the data segment contains log files. | |
| 24 const char* const kFileTypeLogFile = "log_file"; | |
| 25 | |
| 26 // String constant signalling that the segment contains a plain text. | |
| 27 const char* const kContentTypePlainText = "text/plain"; | |
| 28 | |
| 29 // Template string constant for populating the name field. | |
| 30 const char* const kNameFieldTemplate = "file%d"; | |
| 31 } // namespace | 19 } // namespace |
| 32 | 20 |
| 33 namespace policy { | 21 namespace policy { |
| 34 | 22 |
| 23 // String constant identifying the header field which stores the file type. |
| 24 const char* const SystemLogUploadJob::kFileTypeHeaderName = "File-Type"; |
| 25 |
| 26 // String constant signalling that the data segment contains log files. |
| 27 const char* const SystemLogUploadJob::kFileTypeLogFile = "log_file"; |
| 28 |
| 29 // String constant signalling that the segment contains a plain text. |
| 30 const char* const SystemLogUploadJob::kContentTypePlainText = "text/plain"; |
| 31 |
| 32 // Template string constant for populating the name field. |
| 33 const char* const SystemLogUploadJob::kNameFieldTemplate = "file%d"; |
| 34 |
| 35 SystemLogUploadJob::SystemLogUploadJob(scoped_ptr<Delegate> syslog_delegate, | 35 SystemLogUploadJob::SystemLogUploadJob(scoped_ptr<Delegate> syslog_delegate, |
| 36 const base::Closure& succeeded_callback, | 36 const base::Closure& succeeded_callback, |
| 37 const base::Closure& failed_callback) | 37 const base::Closure& failed_callback) |
| 38 : succeeded_callback_(succeeded_callback), | 38 : succeeded_callback_(succeeded_callback), |
| 39 failed_callback_(failed_callback), | 39 failed_callback_(failed_callback), |
| 40 syslog_delegate_(syslog_delegate.Pass()), | 40 syslog_delegate_(syslog_delegate.Pass()), |
| 41 weak_factory_(this) { | 41 weak_factory_(this) { |
| 42 DCHECK(syslog_delegate_); | 42 DCHECK(syslog_delegate_); |
| 43 } | 43 } |
| 44 | 44 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 GURL upload_url(kDefaultUploadUrl); | 92 GURL upload_url(kDefaultUploadUrl); |
| 93 DCHECK(upload_url.is_valid()); | 93 DCHECK(upload_url.is_valid()); |
| 94 | 94 |
| 95 upload_job_ = syslog_delegate_->CreateUploadJob(upload_url, this); | 95 upload_job_ = syslog_delegate_->CreateUploadJob(upload_url, this); |
| 96 DCHECK(upload_job_); | 96 DCHECK(upload_job_); |
| 97 | 97 |
| 98 StartLoadSystemLogs(); | 98 StartLoadSystemLogs(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace policy | 101 } // namespace policy |
| OLD | NEW |