Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 | |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 5 | #ifndef CRASH_REPORTER_UDEV_COLLECTOR_H_ |
| 6 | #define CRASH_REPORTER_UDEV_COLLECTOR_H_ |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 10 | #include <base/files/file_path.h> |
| 11 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 12 | |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 13 | #include "crash-reporter/crash_collector.h" |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 14 | |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 15 | // Udev crash collector. |
| 16 | class UdevCollector : public CrashCollector { |
| 17 | public: |
| 18 | UdevCollector(); |
| 19 | |
Ben Chan | efec0b3 | 2014-08-12 08:52:11 -0700 | [diff] [blame^] | 20 | ~UdevCollector() override; |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 21 | |
| 22 | // The udev event string should be formatted as follows: |
| 23 | // "ACTION=[action]:KERNEL=[name]:SUBSYSTEM=[subsystem]" |
| 24 | // The values don't have to be in any particular order. One or more of them |
| 25 | // could be omitted, in which case it would be treated as a wildcard (*). |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 26 | bool HandleCrash(const std::string& udev_event); |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 27 | |
| 28 | private: |
| 29 | friend class UdevCollectorTest; |
| 30 | |
| 31 | // Mutator for unit testing. |
| 32 | void set_log_config_path(const std::string& path) { |
Simon Que | 9f90aca | 2013-02-19 17:19:52 -0800 | [diff] [blame] | 33 | log_config_path_ = base::FilePath(path); |
Simon Que | acc7938 | 2012-05-04 18:10:09 -0700 | [diff] [blame] | 34 | } |
| 35 | }; |
| 36 | |
Ben Chan | 7e77690 | 2014-06-18 13:19:51 -0700 | [diff] [blame] | 37 | #endif // CRASH_REPORTER_UDEV_COLLECTOR_H_ |