Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/feedback/system_logs/system_logs_fetcher.h

Issue 2969573002: Move SystemLogsSource class into new file (Closed)
Patch Set: rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "chrome/browser/feedback/system_logs/system_logs_source.h"
18 #include "components/feedback/anonymizer_tool.h" 19 #include "components/feedback/anonymizer_tool.h"
19 #include "components/feedback/feedback_common.h" 20 #include "components/feedback/feedback_common.h"
20 21
21 namespace system_logs { 22 namespace system_logs {
22 23
23 using SystemLogsResponse = FeedbackCommon::SystemLogsMap; 24 using SystemLogsResponse = FeedbackCommon::SystemLogsMap;
afakhry 2017/06/30 23:59:27 Nit: Please remove this from here since you moved
michaelpg 2017/07/05 21:27:39 Done.
24 25
25 // Callback that the data sources use to return data.
26 using SysLogsSourceCallback = base::Callback<void(SystemLogsResponse*)>;
27
28 // Callback that the SystemLogsFetcher uses to return data. 26 // Callback that the SystemLogsFetcher uses to return data.
29 using SysLogsFetcherCallback = 27 using SysLogsFetcherCallback =
30 base::Callback<void(std::unique_ptr<SystemLogsResponse>)>; 28 base::Callback<void(std::unique_ptr<SystemLogsResponse>)>;
31 29
32 // The SystemLogsSource provides an interface for the data sources that
33 // the SystemLogsFetcher class uses to fetch logs and other information.
34 class SystemLogsSource {
35 public:
36 // |source_name| provides a descriptive identifier for debugging.
37 explicit SystemLogsSource(const std::string& source_name);
38 virtual ~SystemLogsSource();
39
40 // Fetches data and passes it by pointer to the callback
41 virtual void Fetch(const SysLogsSourceCallback& callback) = 0;
42
43 const std::string& source_name() const { return source_name_; }
44
45 private:
46 std::string source_name_;
47 };
48
49 // The SystemLogsFetcher fetches key-value data from a list of log sources. 30 // The SystemLogsFetcher fetches key-value data from a list of log sources.
50 // 31 //
51 // EXAMPLE: 32 // EXAMPLE:
52 // class Example { 33 // class Example {
53 // public: 34 // public:
54 // void ProcessLogs(SystemLogsResponse* response) { 35 // void ProcessLogs(SystemLogsResponse* response) {
55 // // do something with the logs 36 // // do something with the logs
56 // } 37 // }
57 // void GetLogs() { 38 // void GetLogs() {
58 // SystemLogsFetcher* fetcher = new SystemLogsFetcher(/*scrub_data=*/ true); 39 // SystemLogsFetcher* fetcher = new SystemLogsFetcher(/*scrub_data=*/ true);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 std::unique_ptr<feedback::AnonymizerTool> anonymizer_; 76 std::unique_ptr<feedback::AnonymizerTool> anonymizer_;
96 77
97 base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_; 78 base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_;
98 79
99 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcher); 80 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcher);
100 }; 81 };
101 82
102 } // namespace system_logs 83 } // namespace system_logs
103 84
104 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_ 85 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698