xref: /aosp_15_r20/external/libchrome-gestures/include/logging_filter_interpreter.h (revision aed3e5085e770be5b69ce25295ecf6ddf906af95)
1 // Copyright 2012 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <gtest/gtest.h>
6 #include <string>
7 
8 #include "include/activity_log.h"
9 #include "include/gestures.h"
10 #include "include/filter_interpreter.h"
11 #include "include/prop_registry.h"
12 #include "include/tracer.h"
13 
14 #ifndef GESTURES_LOGGING_FILTER_INTERPRETER_H_
15 #define GESTURES_LOGGING_FILTER_INTERPRETER_H_
16 
17 namespace gestures {
18 // This interpreter keeps an ActivityLog of everything that happens, and can
19 // log it when requested.
20 
21 class LoggingFilterInterpreter : public FilterInterpreter,
22                                  public PropertyDelegate {
23   FRIEND_TEST(ActivityReplayTest, DISABLED_SimpleTest);
24   FRIEND_TEST(LoggingFilterInterpreterTest, LogResetHandlerTest);
25  public:
26   // Takes ownership of |next|:
27   LoggingFilterInterpreter(PropRegistry* prop_reg, Interpreter* next,
28                            Tracer* tracer);
~LoggingFilterInterpreter()29   virtual ~LoggingFilterInterpreter() {}
30 
31   virtual void BoolWasWritten(BoolProperty* prop);
32   virtual void IntWasWritten(IntProperty* prop);
33 
34   std::string EncodeActivityLog();
35 
36  private:
37   void Dump(const char* filename);
38 
39   IntProperty event_debug_logging_enable_;
40   BoolProperty event_logging_enable_;
41   IntProperty logging_notify_;
42   // Reset the log by setting the property value.
43   IntProperty logging_reset_;
44   StringProperty log_location_;
45 
46   // This property is unused by this library, but we need a place to stick it.
47   // If true, this device is an integrated touchpad, as opposed to an external
48   // device.
49   BoolProperty integrated_touchpad_;
50 };
51 }  // namespace gestures
52 
53 #endif  // GESTURES_LOGGING_FILTER_INTERPRETER_H_
54