| 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 "chrome/browser/chromeos/policy/system_log_uploader.h" | 5 #include "chrome/browser/chromeos/policy/system_log_uploader.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 scoped_refptr<base::SequencedTaskRunner> task_runner) | 89 scoped_refptr<base::SequencedTaskRunner> task_runner) |
| 90 : task_runner_(task_runner) {} | 90 : task_runner_(task_runner) {} |
| 91 | 91 |
| 92 SystemLogDelegate::~SystemLogDelegate() {} | 92 SystemLogDelegate::~SystemLogDelegate() {} |
| 93 | 93 |
| 94 void SystemLogDelegate::LoadSystemLogs( | 94 void SystemLogDelegate::LoadSystemLogs( |
| 95 const LogUploadCallback& upload_callback) { | 95 const LogUploadCallback& upload_callback) { |
| 96 // Run ReadFiles() in the thread that interacts with the file system and | 96 // Run ReadFiles() in the thread that interacts with the file system and |
| 97 // return system logs to |upload_callback| on the current thread. | 97 // return system logs to |upload_callback| on the current thread. |
| 98 base::PostTaskWithTraitsAndReplyWithResult( | 98 base::PostTaskWithTraitsAndReplyWithResult( |
| 99 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 99 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 100 base::TaskPriority::BACKGROUND), | |
| 101 base::Bind(&ReadFiles), upload_callback); | 100 base::Bind(&ReadFiles), upload_callback); |
| 102 } | 101 } |
| 103 | 102 |
| 104 std::unique_ptr<policy::UploadJob> SystemLogDelegate::CreateUploadJob( | 103 std::unique_ptr<policy::UploadJob> SystemLogDelegate::CreateUploadJob( |
| 105 const GURL& upload_url, | 104 const GURL& upload_url, |
| 106 policy::UploadJob::Delegate* delegate) { | 105 policy::UploadJob::Delegate* delegate) { |
| 107 chromeos::DeviceOAuth2TokenService* device_oauth2_token_service = | 106 chromeos::DeviceOAuth2TokenService* device_oauth2_token_service = |
| 108 chromeos::DeviceOAuth2TokenServiceFactory::Get(); | 107 chromeos::DeviceOAuth2TokenServiceFactory::Get(); |
| 109 | 108 |
| 110 scoped_refptr<net::URLRequestContextGetter> system_request_context = | 109 scoped_refptr<net::URLRequestContextGetter> system_request_context = |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // Ensure that we never have more than one pending delayed task | 325 // Ensure that we never have more than one pending delayed task |
| 327 // (InvalidateWeakPtrs() will cancel any pending log uploads). | 326 // (InvalidateWeakPtrs() will cancel any pending log uploads). |
| 328 weak_factory_.InvalidateWeakPtrs(); | 327 weak_factory_.InvalidateWeakPtrs(); |
| 329 task_runner_->PostDelayedTask(FROM_HERE, | 328 task_runner_->PostDelayedTask(FROM_HERE, |
| 330 base::Bind(&SystemLogUploader::StartLogUpload, | 329 base::Bind(&SystemLogUploader::StartLogUpload, |
| 331 weak_factory_.GetWeakPtr()), | 330 weak_factory_.GetWeakPtr()), |
| 332 delay); | 331 delay); |
| 333 } | 332 } |
| 334 | 333 |
| 335 } // namespace policy | 334 } // namespace policy |
| OLD | NEW |