| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 5 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 
| 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 
| 7 | 7 | 
| 8 #include <stddef.h> | 8 #include <stddef.h> | 
| 9 | 9 | 
| 10 #include <string> | 10 #include <string> | 
| 11 | 11 | 
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" | 
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" | 
| 14 | 14 | 
|  | 15 #if !defined(OS_WIN) | 
| 15 namespace base { | 16 namespace base { | 
| 16 class FilePath; | 17 class FilePath; | 
| 17 } | 18 } | 
|  | 19 #endif | 
| 18 | 20 | 
| 19 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) | 
| 20 // We don't want to directly include | 22 // We don't want to directly include | 
| 21 // breakpad/src/client/mac/Framework/Breakpad.h here, so we repeat the | 23 // breakpad/src/client/mac/Framework/Breakpad.h here, so we repeat the | 
| 22 // definition of BreakpadRef. | 24 // definition of BreakpadRef. | 
| 23 // | 25 // | 
| 24 // On Mac, when compiling without breakpad support, a stub implementation is | 26 // On Mac, when compiling without breakpad support, a stub implementation is | 
| 25 // compiled in. Not having any includes of the breakpad library allows for | 27 // compiled in. Not having any includes of the breakpad library allows for | 
| 26 // reusing this header for the stub. | 28 // reusing this header for the stub. | 
| 27 typedef void* BreakpadRef; | 29 typedef void* BreakpadRef; | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59 #endif | 61 #endif | 
| 60 | 62 | 
| 61 #if defined(OS_WIN) | 63 #if defined(OS_WIN) | 
| 62   // Returns true if the pipe name to connect to breakpad should be computed and | 64   // Returns true if the pipe name to connect to breakpad should be computed and | 
| 63   // stored in the process's environment block. By default, returns true for the | 65   // stored in the process's environment block. By default, returns true for the | 
| 64   // "browser" process. | 66   // "browser" process. | 
| 65   virtual bool ShouldCreatePipeName(const base::string16& process_type); | 67   virtual bool ShouldCreatePipeName(const base::string16& process_type); | 
| 66 | 68 | 
| 67   // Returns true if an alternative location to store the minidump files was | 69   // Returns true if an alternative location to store the minidump files was | 
| 68   // specified. Returns true if |crash_dir| was set. | 70   // specified. Returns true if |crash_dir| was set. | 
| 69   virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir); | 71   virtual bool GetAlternativeCrashDumpLocation(base::string16* crash_dir); | 
| 70 | 72 | 
| 71   // Returns a textual description of the product type and version to include | 73   // Returns a textual description of the product type and version to include | 
| 72   // in the crash report. | 74   // in the crash report. | 
| 73   virtual void GetProductNameAndVersion(const base::FilePath& exe_path, | 75   virtual void GetProductNameAndVersion(const base::string16& exe_path, | 
| 74                                         base::string16* product_name, | 76                                         base::string16* product_name, | 
| 75                                         base::string16* version, | 77                                         base::string16* version, | 
| 76                                         base::string16* special_build, | 78                                         base::string16* special_build, | 
| 77                                         base::string16* channel_name); | 79                                         base::string16* channel_name); | 
| 78 | 80 | 
| 79   // Returns true if a restart dialog should be displayed. In that case, | 81   // Returns true if a restart dialog should be displayed. In that case, | 
| 80   // |message| and |title| are set to a message to display in a dialog box with | 82   // |message| and |title| are set to a message to display in a dialog box with | 
| 81   // the given title before restarting, and |is_rtl_locale| indicates whether | 83   // the given title before restarting, and |is_rtl_locale| indicates whether | 
| 82   // to display the text as RTL. | 84   // to display the text as RTL. | 
| 83   virtual bool ShouldShowRestartDialog(base::string16* title, | 85   virtual bool ShouldShowRestartDialog(base::string16* title, | 
| 84                                        base::string16* message, | 86                                        base::string16* message, | 
| 85                                        bool* is_rtl_locale); | 87                                        bool* is_rtl_locale); | 
| 86 | 88 | 
| 87   // Returns true if it is ok to restart the application. Invoked right before | 89   // Returns true if it is ok to restart the application. Invoked right before | 
| 88   // restarting after a crash. | 90   // restarting after a crash. | 
| 89   virtual bool AboutToRestart(); | 91   virtual bool AboutToRestart(); | 
| 90 | 92 | 
| 91   // Returns true if the crash report uploader supports deferred uploads. | 93   // Returns true if the crash report uploader supports deferred uploads. | 
| 92   virtual bool GetDeferredUploadsSupported(bool is_per_user_install); | 94   virtual bool GetDeferredUploadsSupported(bool is_per_user_install); | 
| 93 | 95 | 
| 94   // Returns true if the running binary is a per-user installation. | 96   // Returns true if the running binary is a per-user installation. | 
| 95   virtual bool GetIsPerUserInstall(const base::FilePath& exe_path); | 97   virtual bool GetIsPerUserInstall(const base::string16& exe_path); | 
| 96 | 98 | 
| 97   // Returns true if larger crash dumps should be dumped. | 99   // Returns true if larger crash dumps should be dumped. | 
| 98   virtual bool GetShouldDumpLargerDumps(bool is_per_user_install); | 100   virtual bool GetShouldDumpLargerDumps(bool is_per_user_install); | 
| 99 | 101 | 
| 100   // Returns the result code to return when breakpad failed to respawn a | 102   // Returns the result code to return when breakpad failed to respawn a | 
| 101   // crashed process. | 103   // crashed process. | 
| 102   virtual int GetResultCodeRespawnFailed(); | 104   virtual int GetResultCodeRespawnFailed(); | 
| 103 #endif | 105 #endif | 
| 104 | 106 | 
| 105 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) | 107 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) | 
| 106   // Returns a textual description of the product type and version to include | 108   // Returns a textual description of the product type and version to include | 
| 107   // in the crash report. Neither out parameter should be set to NULL. | 109   // in the crash report. Neither out parameter should be set to NULL. | 
| 108   virtual void GetProductNameAndVersion(const char** product_name, | 110   virtual void GetProductNameAndVersion(const char** product_name, | 
| 109                                         const char** version); | 111                                         const char** version); | 
| 110 | 112 | 
| 111   virtual base::FilePath GetReporterLogFilename(); | 113   virtual base::FilePath GetReporterLogFilename(); | 
| 112 | 114 | 
| 113   // Custom crash minidump handler after the minidump is generated. | 115   // Custom crash minidump handler after the minidump is generated. | 
| 114   // Returns true if the minidump is handled (client); otherwise, return false | 116   // Returns true if the minidump is handled (client); otherwise, return false | 
| 115   // to fallback to default handler. | 117   // to fallback to default handler. | 
| 116   // WARNING: this handler runs in a compromised context. It may not call into | 118   // WARNING: this handler runs in a compromised context. It may not call into | 
| 117   // libc nor allocate memory normally. | 119   // libc nor allocate memory normally. | 
| 118   virtual bool HandleCrashDump(const char* crashdump_filename); | 120   virtual bool HandleCrashDump(const char* crashdump_filename); | 
| 119 #endif | 121 #endif | 
| 120 | 122 | 
| 121   // The location where minidump files should be written. Returns true if | 123   // The location where minidump files should be written. Returns true if | 
| 122   // |crash_dir| was set. | 124   // |crash_dir| was set. | 
|  | 125 #if defined(OS_WIN) | 
|  | 126   virtual bool GetCrashDumpLocation(base::string16* crash_dir); | 
|  | 127 #else | 
| 123   virtual bool GetCrashDumpLocation(base::FilePath* crash_dir); | 128   virtual bool GetCrashDumpLocation(base::FilePath* crash_dir); | 
|  | 129 #endif | 
| 124 | 130 | 
| 125   // Register all of the potential crash keys that can be sent to the crash | 131   // Register all of the potential crash keys that can be sent to the crash | 
| 126   // reporting server. Returns the size of the union of all keys. | 132   // reporting server. Returns the size of the union of all keys. | 
| 127   virtual size_t RegisterCrashKeys(); | 133   virtual size_t RegisterCrashKeys(); | 
| 128 | 134 | 
| 129   // Returns true if running in unattended mode (for automated testing). | 135   // Returns true if running in unattended mode (for automated testing). | 
| 130   virtual bool IsRunningUnattended(); | 136   virtual bool IsRunningUnattended(); | 
| 131 | 137 | 
| 132   // Returns true if the user has given consent to collect stats. | 138   // Returns true if the user has given consent to collect stats. | 
| 133   virtual bool GetCollectStatsConsent(); | 139   virtual bool GetCollectStatsConsent(); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 147   virtual bool ShouldEnableBreakpadMicrodumps(); | 153   virtual bool ShouldEnableBreakpadMicrodumps(); | 
| 148 #endif | 154 #endif | 
| 149 | 155 | 
| 150   // Returns true if breakpad should run in the given process type. | 156   // Returns true if breakpad should run in the given process type. | 
| 151   virtual bool EnableBreakpadForProcess(const std::string& process_type); | 157   virtual bool EnableBreakpadForProcess(const std::string& process_type); | 
| 152 }; | 158 }; | 
| 153 | 159 | 
| 154 }  // namespace crash_reporter | 160 }  // namespace crash_reporter | 
| 155 | 161 | 
| 156 #endif  // COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 162 #endif  // COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_ | 
| OLD | NEW | 
|---|