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