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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "chrome/browser/chromeos/policy/upload_job.h" | 17 #include "chrome/browser/chromeos/policy/upload_job.h" |
18 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
22 } | 22 } |
23 | 23 |
24 namespace feedback { | |
25 class AnonymizerTool; | |
26 } | |
27 | |
24 namespace policy { | 28 namespace policy { |
25 | 29 |
26 // Class responsible for periodically uploading system logs, it handles the | 30 // Class responsible for periodically uploading system logs, it handles the |
27 // server responses by UploadJob:Delegate callbacks. | 31 // server responses by UploadJob:Delegate callbacks. |
28 class SystemLogUploader : public UploadJob::Delegate { | 32 class SystemLogUploader : public UploadJob::Delegate { |
29 public: | 33 public: |
30 // Structure that stores the system log files as pairs: (file name, loaded | 34 // Structure that stores the system log files as pairs: (file name, loaded |
31 // from the disk binary file data). | 35 // from the disk binary file data). |
32 typedef std::vector<std::pair<std::string, std::string>> SystemLogs; | 36 typedef std::vector<std::pair<std::string, std::string>> SystemLogs; |
33 | 37 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // Returns the time of the last upload attempt, or Time(0) if no upload has | 75 // Returns the time of the last upload attempt, or Time(0) if no upload has |
72 // ever happened. | 76 // ever happened. |
73 base::Time last_upload_attempt() const { return last_upload_attempt_; } | 77 base::Time last_upload_attempt() const { return last_upload_attempt_; } |
74 | 78 |
75 // UploadJob::Delegate: | 79 // UploadJob::Delegate: |
76 // Callbacks handle success and failure results of upload, destroy the | 80 // Callbacks handle success and failure results of upload, destroy the |
77 // upload job. | 81 // upload job. |
78 void OnSuccess() override; | 82 void OnSuccess() override; |
79 void OnFailure(UploadJob::ErrorCode error_code) override; | 83 void OnFailure(UploadJob::ErrorCode error_code) override; |
80 | 84 |
81 // Remove lines from |data| that contain common PII (IP addresses, SSIDs, URLs | 85 // Remove lines from |data| that contain common PII (IP addresses, BSSIDs, |
82 // e-mail addresses). | 86 // SSIDs, URLs, e-mail addresses). |
83 static std::string RemoveSensitiveData(const std::string& data); | 87 static std::string RemoveSensitiveData( |
88 feedback::AnonymizerTool* const anonymizer, | |
jochen (gone - plz use gerrit)
2016/01/26 11:47:39
can this pointer also be const?
Polina Bondarenko
2016/01/26 12:47:30
No, AnonymizerTool can't be const, it calls non-co
| |
89 const std::string& data); | |
84 | 90 |
85 private: | 91 private: |
86 // Updates the system log upload enabled field from settings. | 92 // Updates the system log upload enabled field from settings. |
87 void RefreshUploadSettings(); | 93 void RefreshUploadSettings(); |
88 | 94 |
89 // Starts the system log loading process. | 95 // Starts the system log loading process. |
90 void StartLogUpload(); | 96 void StartLogUpload(); |
91 | 97 |
92 // The callback is invoked by the Delegate if system logs have been loaded | 98 // The callback is invoked by the Delegate if system logs have been loaded |
93 // from disk, uploads system logs. | 99 // from disk, uploads system logs. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 // Note: This should remain the last member so it'll be destroyed and | 135 // Note: This should remain the last member so it'll be destroyed and |
130 // invalidate the weak pointers before any other members are destroyed. | 136 // invalidate the weak pointers before any other members are destroyed. |
131 base::WeakPtrFactory<SystemLogUploader> weak_factory_; | 137 base::WeakPtrFactory<SystemLogUploader> weak_factory_; |
132 | 138 |
133 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader); | 139 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader); |
134 }; | 140 }; |
135 | 141 |
136 } // namespace policy | 142 } // namespace policy |
137 | 143 |
138 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ | 144 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ |
OLD | NEW |