| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ |
| 6 #define CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ | 6 #define CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void AddSource(std::unique_ptr<SystemLogsSource> source); | 73 void AddSource(std::unique_ptr<SystemLogsSource> source); |
| 74 | 74 |
| 75 // Starts the fetch process. | 75 // Starts the fetch process. |
| 76 void Fetch(const SysLogsFetcherCallback& callback); | 76 void Fetch(const SysLogsFetcherCallback& callback); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 // Callback passed to all the data sources. May call Scrub(), then calls | 79 // Callback passed to all the data sources. May call Scrub(), then calls |
| 80 // AddResponse(). | 80 // AddResponse(). |
| 81 void OnFetched(const std::string& source_name, SystemLogsResponse* response); | 81 void OnFetched(const std::string& source_name, SystemLogsResponse* response); |
| 82 | 82 |
| 83 // Anonymizes the response data. | |
| 84 void Scrub(SystemLogsResponse* response); | |
| 85 | |
| 86 // Merges the |response| it receives into response_. When all the data sources | 83 // Merges the |response| it receives into response_. When all the data sources |
| 87 // have responded, it deletes their objects and returns the response to the | 84 // have responded, it deletes their objects and returns the response to the |
| 88 // callback_. After this it deletes this instance of the object. | 85 // callback_. After this it deletes this instance of the object. |
| 89 void AddResponse(const std::string& source_name, | 86 void AddResponse(const std::string& source_name, |
| 90 SystemLogsResponse* response); | 87 SystemLogsResponse* response); |
| 91 | 88 |
| 92 std::vector<std::unique_ptr<SystemLogsSource>> data_sources_; | 89 std::vector<std::unique_ptr<SystemLogsSource>> data_sources_; |
| 93 SysLogsFetcherCallback callback_; | 90 SysLogsFetcherCallback callback_; |
| 94 | 91 |
| 95 std::unique_ptr<SystemLogsResponse> response_; // The actual response data. | 92 std::unique_ptr<SystemLogsResponse> response_; // The actual response data. |
| 96 size_t num_pending_requests_; // The number of callbacks it should get. | 93 size_t num_pending_requests_; // The number of callbacks it should get. |
| 97 | 94 |
| 98 std::unique_ptr<feedback::AnonymizerTool> anonymizer_; | 95 std::unique_ptr<feedback::AnonymizerTool> anonymizer_; |
| 99 | 96 |
| 100 base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_; | 97 base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_; |
| 101 | 98 |
| 102 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcher); | 99 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcher); |
| 103 }; | 100 }; |
| 104 | 101 |
| 105 } // namespace system_logs | 102 } // namespace system_logs |
| 106 | 103 |
| 107 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ | 104 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ |
| OLD | NEW |