blob: e54ce5b431e2c9ded2e3e2314839192993e336e9 [file] [log] [blame]
Simon Queacc79382012-05-04 18:10:09 -07001// 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 Chan7e776902014-06-18 13:19:51 -07005#ifndef CRASH_REPORTER_UDEV_COLLECTOR_H_
6#define CRASH_REPORTER_UDEV_COLLECTOR_H_
Simon Queacc79382012-05-04 18:10:09 -07007
8#include <string>
9
Ben Chan7e776902014-06-18 13:19:51 -070010#include <base/files/file_path.h>
11#include <gtest/gtest_prod.h> // for FRIEND_TEST
12
Simon Queacc79382012-05-04 18:10:09 -070013#include "crash-reporter/crash_collector.h"
Simon Queacc79382012-05-04 18:10:09 -070014
Simon Queacc79382012-05-04 18:10:09 -070015// Udev crash collector.
16class 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 (*).
Ben Chan7e776902014-06-18 13:19:51 -070026 bool HandleCrash(const std::string& udev_event);
Simon Queacc79382012-05-04 18:10:09 -070027
28 private:
29 friend class UdevCollectorTest;
30
31 // Mutator for unit testing.
32 void set_log_config_path(const std::string& path) {
Simon Que9f90aca2013-02-19 17:19:52 -080033 log_config_path_ = base::FilePath(path);
Simon Queacc79382012-05-04 18:10:09 -070034 }
35};
36
Ben Chan7e776902014-06-18 13:19:51 -070037#endif // CRASH_REPORTER_UDEV_COLLECTOR_H_