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 | |
| 5 | #ifndef _CRASH_REPORTER_UDEV_COLLECTOR_H_ |
| 6 | #define _CRASH_REPORTER_UDEV_COLLECTOR_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "crash-reporter/crash_collector.h" |
| 11 | #include "gtest/gtest_prod.h" // for FRIEND_TEST |
| 12 | |
| 13 | class FilePath; |
| 14 | |
| 15 | // Udev crash collector. |
| 16 | class UdevCollector : public CrashCollector { |
| 17 | public: |
| 18 | UdevCollector(); |
| 19 | |
| 20 | virtual ~UdevCollector(); |
| 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 (*). |
| 26 | bool HandleCrash(const std::string &udev_event); |
| 27 | |
| 28 | private: |
| 29 | friend class UdevCollectorTest; |
| 30 | |
| 31 | // Mutator for unit testing. |
| 32 | void set_log_config_path(const std::string& path) { |
| 33 | log_config_path_ = FilePath(path); |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | #endif // _CRASH_REPORTER_UDEV_COLLECTOR_H_ |