OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
7 | 7 |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 // The number of days to wait before triggering another reporter run. | 43 // The number of days to wait before triggering another reporter run. |
44 const int kDaysBetweenSuccessfulSwReporterRuns = 7; | 44 const int kDaysBetweenSuccessfulSwReporterRuns = 7; |
45 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; | 45 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; |
46 // The number of days to wait before sending out reporter logs. | 46 // The number of days to wait before sending out reporter logs. |
47 const int kDaysBetweenReporterLogsSent = 7; | 47 const int kDaysBetweenReporterLogsSent = 7; |
48 | 48 |
49 extern const char kExtendedSafeBrowsingEnabledSwitch[]; | 49 extern const char kExtendedSafeBrowsingEnabledSwitch[]; |
50 | 50 |
51 extern const base::Feature kSwReporterExtendedSafeBrowsingFeature; | 51 extern const base::Feature kSwReporterExtendedSafeBrowsingFeature; |
52 | 52 |
53 // The possible behaviours implemented by the Software Reporter. | |
54 enum class SwReporterBehaviours : uint8_t { | |
55 ALL_DISABLED = 0x0, | |
56 LOG_TO_RAPPOR = 0x1, | |
57 LOG_EXIT_CODE_TO_PREFS = 0x2, | |
58 TRIGGER_PROMPT = 0x4, | |
59 SEND_REPORTER_LOGS = 0x8, | |
60 }; | |
61 | |
62 SwReporterBehaviours operator&(SwReporterBehaviours a, SwReporterBehaviours b); | |
grt (UTC plus 2)
2016/09/16 20:12:42
oh my. this is overcomplicating things. i'm sorry
ftirelo
2016/09/16 21:00:10
Done. However, please notice that I kep BehaviourI
| |
63 SwReporterBehaviours operator|(SwReporterBehaviours a, SwReporterBehaviours b); | |
64 | |
65 // Returns true if |intended_behaviour| is enabled in |behaviours|. | |
66 bool BehaviourIsEnabled(SwReporterBehaviours behaviours, | |
67 SwReporterBehaviours intended_behaviour); | |
68 | |
53 // Parameters used to invoke the sw_reporter component. | 69 // Parameters used to invoke the sw_reporter component. |
54 struct SwReporterInvocation { | 70 struct SwReporterInvocation { |
55 base::CommandLine command_line; | 71 base::CommandLine command_line; |
56 | 72 |
57 // Experimental versions of the reporter will write metrics to registry keys | 73 // Experimental versions of the reporter will write metrics to registry keys |
58 // ending in |suffix|. Those metrics should be copied to UMA histograms also | 74 // ending in |suffix|. Those metrics should be copied to UMA histograms also |
59 // ending in |suffix|. For the canonical version, |suffix| will be empty. | 75 // ending in |suffix|. For the canonical version, |suffix| will be empty. |
60 std::string suffix; | 76 std::string suffix; |
61 | 77 |
62 // Flags to control optional behaviours. By default all are enabled; | 78 // Flags to control behaviours the Software Reporter should support by |
63 // experimental versions of the reporter will turn off the behaviours that | 79 // default. These flags are set in the Reporter installer, and experimental |
64 // are not yet supported. | 80 // versions of the reporter will turn off the behaviours that are not yet |
65 using Flags = uint32_t; | 81 // supported. |
66 enum : Flags { | 82 SwReporterBehaviours supported_behaviours = |
67 FLAG_LOG_TO_RAPPOR = 0x1, | 83 SwReporterBehaviours::ALL_DISABLED; |
68 FLAG_LOG_EXIT_CODE_TO_PREFS = 0x2, | 84 |
69 FLAG_TRIGGER_PROMPT = 0x4, | 85 // Whether logs upload was enabled in this invocation. |
70 FLAG_SEND_REPORTER_LOGS = 0x8, | 86 bool logs_upload_enabled = false; |
71 }; | |
72 Flags flags = 0; | |
73 | 87 |
74 SwReporterInvocation(); | 88 SwReporterInvocation(); |
75 | 89 |
76 static SwReporterInvocation FromFilePath(const base::FilePath& exe_path); | 90 static SwReporterInvocation FromFilePath(const base::FilePath& exe_path); |
77 static SwReporterInvocation FromCommandLine( | 91 static SwReporterInvocation FromCommandLine( |
78 const base::CommandLine& command_line); | 92 const base::CommandLine& command_line); |
79 | 93 |
80 bool operator==(const SwReporterInvocation& other) const; | 94 bool operator==(const SwReporterInvocation& other) const; |
81 }; | 95 }; |
82 | 96 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 146 |
133 // Set a delegate for testing. The implementation will not take ownership of | 147 // Set a delegate for testing. The implementation will not take ownership of |
134 // |delegate| - it must remain valid until this function is called again to | 148 // |delegate| - it must remain valid until this function is called again to |
135 // reset the delegate. If |delegate| is nullptr, any previous delegate is | 149 // reset the delegate. If |delegate| is nullptr, any previous delegate is |
136 // cleared. | 150 // cleared. |
137 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); | 151 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); |
138 | 152 |
139 } // namespace safe_browsing | 153 } // namespace safe_browsing |
140 | 154 |
141 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 155 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
OLD | NEW |