Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / chromecast / app / android / crash_handler.h
blobd4a79754d07389c05478dd780065fcf316900cfc
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_APP_ANDROID_CRASH_HANDLER_H_
6 #define CHROMECAST_APP_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 chromecast {
16 class CastCrashReporterClientAndroid;
18 class CrashHandler {
19 public:
20 // Initializes the crash handler for attempting to upload crash dumps with
21 // the current process's log file.
22 // Must not be called more than once.
23 static void Initialize(const std::string& process_type,
24 const base::FilePath& log_file_path);
26 // Returns the directory location for crash dumps.
27 static bool GetCrashDumpLocation(base::FilePath* crash_dir);
29 // Registers JNI methods for this module.
30 static bool RegisterCastCrashJni(JNIEnv* env);
32 private:
33 CrashHandler(const std::string& process_type,
34 const base::FilePath& log_file_path);
35 ~CrashHandler();
37 void Initialize();
39 // Starts a thread to periodically check for uploads
40 void InitializeUploader();
42 // Path to the current process's log file.
43 base::FilePath log_file_path_;
45 // Location to which crash dumps should be written.
46 base::FilePath crash_dump_path_;
48 std::string process_type_;
50 scoped_ptr<CastCrashReporterClientAndroid> crash_reporter_client_;
52 DISALLOW_COPY_AND_ASSIGN(CrashHandler);
55 } // namespace chromecast
57 #endif // CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_