| 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/chromeos/policy/system_log_upload_job.h" | 14 #include "chrome/browser/chromeos/policy/system_log_upload_job.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace policy { | 20 namespace policy { |
| 21 | 21 |
| 22 // Class responsible for periodically uploading system logs. | 22 // Class responsible for periodically uploading system logs. |
| 23 class SystemLogUploader { | 23 class SystemLogUploader { |
| 24 public: | 24 public: |
| 25 // Determines the time between log uploads. |
| 26 static const int64 kDefaultUploadDelayMs; |
| 27 |
| 28 // Determines the time, measured from the time of last failed upload, |
| 29 // after which the log upload is retried. |
| 30 static const int64 kErrorUploadDelayMs; |
| 31 |
| 25 explicit SystemLogUploader( | 32 explicit SystemLogUploader( |
| 26 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 33 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| 27 | 34 |
| 28 virtual ~SystemLogUploader(); | 35 virtual ~SystemLogUploader(); |
| 29 | 36 |
| 30 // Returns the time of the last upload attempt, or the class creation time | 37 // Returns the time of the last upload attempt, or the class creation time |
| 31 // if no upload has ever happened. | 38 // if no upload has ever happened. |
| 32 base::Time last_upload_attempt() const { return last_upload_attempt_; } | 39 base::Time last_upload_attempt() const { return last_upload_attempt_; } |
| 33 | 40 |
| 34 private: | 41 private: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 // Note: This should remain the last member so it'll be destroyed and | 72 // Note: This should remain the last member so it'll be destroyed and |
| 66 // invalidate the weak pointers before any other members are destroyed. | 73 // invalidate the weak pointers before any other members are destroyed. |
| 67 base::WeakPtrFactory<SystemLogUploader> weak_factory_; | 74 base::WeakPtrFactory<SystemLogUploader> weak_factory_; |
| 68 | 75 |
| 69 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader); | 76 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader); |
| 70 }; | 77 }; |
| 71 | 78 |
| 72 } // namespace policy | 79 } // namespace policy |
| 73 | 80 |
| 74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ | 81 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ |
| OLD | NEW |