Roll libvpx 861f35:1fff3e
[chromium-blink-merge.git] / chromecast / crash / android / crash_handler.h
blob853e7f50973e99e5b8be768374c802a8652f92f4
1 // Copyright 2014 The Chromium 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.
5 #ifndef CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_
6 #define CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_
8 #include <jni.h>
9 #include <string>
11 #include "base/files/file_path.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
15 namespace google_breakpad {
16 class ExceptionHandler;
19 namespace chromecast {
20 class CastCrashReporterClientAndroid;
22 class CrashHandler {
23 public:
24 // Initializes the crash handler for attempting to upload crash dumps with
25 // the current process's log file.
26 // Must not be called more than once.
27 static void Initialize(const std::string& process_type,
28 const base::FilePath& log_file_path);
30 // Returns the directory location for crash dumps.
31 static bool GetCrashDumpLocation(base::FilePath* crash_dir);
33 // Registers JNI methods for this module.
34 static bool RegisterCastCrashJni(JNIEnv* env);
36 // Returns whether or not the user has allowed for uploading crash dumps.
37 bool CanUploadCrashDump();
39 void UploadCrashDumps();
41 private:
42 CrashHandler(const base::FilePath& log_file_path);
43 ~CrashHandler();
45 void Initialize(const std::string& process_type);
47 // Starts a thread to periodically check for uploads
48 void InitializeUploader();
50 // Path to the current process's log file.
51 base::FilePath log_file_path_;
53 // Location to which crash dumps should be written.
54 base::FilePath crash_dump_path_;
56 scoped_ptr<CastCrashReporterClientAndroid> crash_reporter_client_;
57 scoped_ptr<google_breakpad::ExceptionHandler> crash_uploader_;
59 DISALLOW_COPY_AND_ASSIGN(CrashHandler);
62 } // namespace chromecast
64 #endif // CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_