blob: 68eb85a4f31e1fd74c2ad36beaa704a367bd9dac [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>
Ben Chan895fa5d2014-09-02 20:58:20 -070011#include <base/macros.h>
Ben Chan7e776902014-06-18 13:19:51 -070012#include <gtest/gtest_prod.h> // for FRIEND_TEST
13
Simon Queacc79382012-05-04 18:10:09 -070014#include "crash-reporter/crash_collector.h"
Simon Queacc79382012-05-04 18:10:09 -070015
Simon Queacc79382012-05-04 18:10:09 -070016// Udev crash collector.
17class UdevCollector : public CrashCollector {
18 public:
19 UdevCollector();
20
Ben Chanefec0b32014-08-12 08:52:11 -070021 ~UdevCollector() override;
Simon Queacc79382012-05-04 18:10:09 -070022
23 // The udev event string should be formatted as follows:
24 // "ACTION=[action]:KERNEL=[name]:SUBSYSTEM=[subsystem]"
25 // The values don't have to be in any particular order. One or more of them
26 // could be omitted, in which case it would be treated as a wildcard (*).
Ben Chan7e776902014-06-18 13:19:51 -070027 bool HandleCrash(const std::string& udev_event);
Simon Queacc79382012-05-04 18:10:09 -070028
29 private:
30 friend class UdevCollectorTest;
31
32 // Mutator for unit testing.
33 void set_log_config_path(const std::string& path) {
Simon Que9f90aca2013-02-19 17:19:52 -080034 log_config_path_ = base::FilePath(path);
Simon Queacc79382012-05-04 18:10:09 -070035 }
Ben Chan895fa5d2014-09-02 20:58:20 -070036
37 DISALLOW_COPY_AND_ASSIGN(UdevCollector);
Simon Queacc79382012-05-04 18:10:09 -070038};
39
Ben Chan7e776902014-06-18 13:19:51 -070040#endif // CRASH_REPORTER_UDEV_COLLECTOR_H_