| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_H_ | |
| 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_H_ | |
| 7 | |
| 8 #include <time.h> | |
| 9 | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/files/file_path.h" | |
| 14 | |
| 15 namespace crash_reporter { | |
| 16 | |
| 17 // Initializes Crashpad in a way that is appropriate for initial_client and | |
| 18 // process_type. | |
| 19 // | |
| 20 // If initial_client is true, this starts crashpad_handler and sets it as the | |
| 21 // exception handler. Child processes will inherit this exception handler, and | |
| 22 // should specify false for this parameter. Although they inherit the exception | |
| 23 // handler, child processes still need to call this function to perform | |
| 24 // additional initialization. | |
| 25 // | |
| 26 // If process_type is empty, initialization will be done for the browser | |
| 27 // process. The browser process performs additional initialization of the crash | |
| 28 // report database. The browser process is also the only process type that is | |
| 29 // eligible to have its crashes forwarded to the system crash report handler (in | |
| 30 // release mode only). Note that when process_type is empty, initial_client must | |
| 31 // be true. | |
| 32 // | |
| 33 // On Mac, process_type may be non-empty with initial_client set to true. This | |
| 34 // indicates that an exception handler has been inherited but should be | |
| 35 // discarded in favor of a new Crashpad handler. This configuration should be | |
| 36 // used infrequently. It is provided to allow an install-from-.dmg relauncher | |
| 37 // process to disassociate from an old Crashpad handler so that after performing | |
| 38 // an installation from a disk image, the relauncher process may unmount the | |
| 39 // disk image that contains its inherited crashpad_handler. This is only | |
| 40 // supported when initial_client is true and process_type is "relauncher". | |
| 41 void InitializeCrashpad(bool initial_client, const std::string& process_type); | |
| 42 | |
| 43 // Enables or disables crash report upload. This is a property of the Crashpad | |
| 44 // database. In a newly-created database, uploads will be disabled. This | |
| 45 // function only has an effect when called in the browser process. Its effect is | |
| 46 // immediate and applies to all other process types, including processes that | |
| 47 // are already running. | |
| 48 void SetUploadsEnabled(bool enabled); | |
| 49 | |
| 50 // Determines whether uploads are enabled or disabled. This information is only | |
| 51 // available in the browser process. | |
| 52 bool GetUploadsEnabled(); | |
| 53 | |
| 54 struct UploadedReport { | |
| 55 std::string local_id; | |
| 56 std::string remote_id; | |
| 57 time_t creation_time; | |
| 58 }; | |
| 59 | |
| 60 // Obtains a list of reports uploaded to the collection server. This function | |
| 61 // only operates when called in the browser process. All reports in the Crashpad | |
| 62 // database that have been successfully uploaded will be included in this list. | |
| 63 // The list will be sorted in descending order by report creation time (newest | |
| 64 // reports first). | |
| 65 // | |
| 66 // TODO(mark): The about:crashes UI expects to show only uploaded reports. If it | |
| 67 // is ever enhanced to work well with un-uploaded reports, those should be | |
| 68 // returned as well. Un-uploaded reports may have a pending upload, may have | |
| 69 // experienced upload failure, or may have been collected while uploads were | |
| 70 // disabled. | |
| 71 void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports); | |
| 72 | |
| 73 namespace internal { | |
| 74 | |
| 75 // The platform-specific portion of InitializeCrashpad(). | |
| 76 // Returns the database path, if initializing in the browser process. | |
| 77 base::FilePath PlatformCrashpadInitialization(bool initial_client, | |
| 78 bool browser_process); | |
| 79 | |
| 80 } // namespace internal | |
| 81 | |
| 82 } // namespace crash_reporter | |
| 83 | |
| 84 #endif // COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_H_ | |
| OLD | NEW |