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

Side by Side Diff: chrome/browser/metrics/antivirus_metrics_provider_win.h

Issue 2009773007: Add AntiVirus information to the system profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hash the product name and version Created 4 years, 6 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_
6 #define CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_
7
8 #include "components/metrics/metrics_provider.h"
9
10 #include <iwscapi.h>
Alexei Svitkine (slow) 2016/06/01 20:42:35 Nit: No blank lines between the different system h
Will Harris 2016/06/02 20:36:27 Done.
11
12 #include <stddef.h>
13
14 #include <string>
15 #include <vector>
16
17 #include "base/callback_forward.h"
18 #include "base/gtest_prod_util.h"
19 #include "base/macros.h"
20 #include "base/memory/weak_ptr.h"
21 #include "base/sequenced_task_runner.h"
22 #include "base/threading/thread_checker.h"
23 #include "components/metrics/proto/system_profile.pb.h"
24
25 namespace metrics {
26
27 // AntiVirusMetricsProvider is responsible for adding antivirus information to
28 // the UMA system profile proto.
29 class AntiVirusMetricsProvider : public metrics::MetricsProvider {
30 public:
31 explicit AntiVirusMetricsProvider(
32 scoped_refptr<base::SequencedTaskRunner> file_thread);
33 ~AntiVirusMetricsProvider() override;
34
35 // metrics::MetricsDataProvider:
36 void ProvideSystemProfileMetrics(
37 metrics::SystemProfileProto* system_profile_proto) override;
38
39 // Called to gather metrics, before calling ProvideSystemProfileMetrics.
40 void GetAntiVirusMetrics(const base::Closure& done_callback);
41
42 private:
43 struct AvProduct {
44 SystemProfileProto::AntiVirusState product_state;
45 std::wstring product_name;
46 std::wstring product_version;
47 };
48 typedef std::vector<AvProduct> AvProductList;
49
50 static bool FillAntiVirusProducts(AvProductList* products);
51 static AvProductList GetAntiVirusProductsOnFileThread();
52
53 // Called when metrics are done being gathered from the FILE thread.
54 // |done_callback| is the callback that should be called once all metrics are
55 // gathered.
56 void GotAntiVirusProducts(const base::Closure& done_callback,
57 const AvProductList& av_products);
58
59 // The thread on which file operations are performed (supplied by the
60 // embedder).
61 scoped_refptr<base::SequencedTaskRunner> file_thread_;
62
63 // Information on installed AntiVirus gathered.
64 AvProductList av_products_;
65
66 base::ThreadChecker thread_checker_;
67 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_;
68
69 FRIEND_TEST_ALL_PREFIXES(AntiVirusMetricsProviderTest, GetAvProducts);
70
71 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider);
72 };
73
74 } // namespace metrics
75
76 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698