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_APP_BREAKPAD_CLIENT_H_ | 5 #ifndef COMPONENTS_CRASH_APP_CRASH_REPORTER_CLIENT_H_ |
6 #define COMPONENTS_CRASH_APP_BREAKPAD_CLIENT_H_ | 6 #define COMPONENTS_CRASH_APP_CRASH_REPORTER_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class FilePath; | 14 class FilePath; |
15 } | 15 } |
16 | 16 |
17 #if defined(OS_MACOSX) | 17 #if defined(OS_MACOSX) |
18 // We don't want to directly include | 18 // We don't want to directly include |
19 // breakpad/src/client/mac/Framework/Breakpad.h here, so we repeat the | 19 // breakpad/src/client/mac/Framework/Breakpad.h here, so we repeat the |
20 // definition of BreakpadRef. | 20 // definition of BreakpadRef. |
21 // | 21 // |
22 // On Mac, when compiling without breakpad support, a stub implementation is | 22 // On Mac, when compiling without breakpad support, a stub implementation is |
23 // compiled in. Not having any includes of the breakpad library allows for | 23 // compiled in. Not having any includes of the breakpad library allows for |
24 // reusing this header for the stub. | 24 // reusing this header for the stub. |
25 typedef void* BreakpadRef; | 25 typedef void* BreakpadRef; |
26 #endif | 26 #endif |
27 | 27 |
28 namespace breakpad { | 28 namespace crash_reporter { |
29 | 29 |
30 class BreakpadClient; | 30 class CrashReporterClient; |
31 | 31 |
32 // Setter and getter for the client. The client should be set early, before any | 32 // Setter and getter for the client. The client should be set early, before any |
33 // breakpad code is called, and should stay alive throughout the entire runtime. | 33 // crash reporter code is called, and should stay alive throughout the entire |
34 void SetBreakpadClient(BreakpadClient* client); | 34 // runtime. |
| 35 void SetCrashReporterClient(CrashReporterClient* client); |
35 | 36 |
36 #if defined(CRASH_IMPLEMENTATION) | 37 #if defined(CRASH_IMPLEMENTATION) |
37 // Breakpad's embedder API should only be used by breakpad. | 38 // The components's embedder API should only be used by the component. |
38 BreakpadClient* GetBreakpadClient(); | 39 CrashReporterClient* GetCrashReporterClient(); |
39 #endif | 40 #endif |
40 | 41 |
41 // Interface that the embedder implements. | 42 // Interface that the embedder implements. |
42 class BreakpadClient { | 43 class CrashReporterClient { |
43 public: | 44 public: |
44 BreakpadClient(); | 45 CrashReporterClient(); |
45 virtual ~BreakpadClient(); | 46 virtual ~CrashReporterClient(); |
46 | 47 |
47 // Sets the Breakpad client ID, which is a unique identifier for the client | 48 // Sets the crash reporting client ID, a unique identifier for the client |
48 // that is sending crash reports. After it is set, it should not be changed. | 49 // that is sending crash reports. After it is set, it should not be changed. |
49 // |client_guid| may either be a full GUID or a GUID that was already stripped | 50 // |client_guid| may either be a full GUID or a GUID that was already stripped |
50 // from its dashes. | 51 // from its dashes. |
51 virtual void SetBreakpadClientIdFromGUID(const std::string& client_guid); | 52 virtual void SetCrashReporterClientIdFromGUID(const std::string& client_guid); |
52 | 53 |
53 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
54 // Returns true if an alternative location to store the minidump files was | 55 // Returns true if an alternative location to store the minidump files was |
55 // specified. Returns true if |crash_dir| was set. | 56 // specified. Returns true if |crash_dir| was set. |
56 virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir); | 57 virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir); |
57 | 58 |
58 // Returns a textual description of the product type and version to include | 59 // Returns a textual description of the product type and version to include |
59 // in the crash report. | 60 // in the crash report. |
60 virtual void GetProductNameAndVersion(const base::FilePath& exe_path, | 61 virtual void GetProductNameAndVersion(const base::FilePath& exe_path, |
61 base::string16* product_name, | 62 base::string16* product_name, |
(...skipping 19 matching lines...) Expand all Loading... |
81 // Returns true if the running binary is a per-user installation. | 82 // Returns true if the running binary is a per-user installation. |
82 virtual bool GetIsPerUserInstall(const base::FilePath& exe_path); | 83 virtual bool GetIsPerUserInstall(const base::FilePath& exe_path); |
83 | 84 |
84 // Returns true if larger crash dumps should be dumped. | 85 // Returns true if larger crash dumps should be dumped. |
85 virtual bool GetShouldDumpLargerDumps(bool is_per_user_install); | 86 virtual bool GetShouldDumpLargerDumps(bool is_per_user_install); |
86 | 87 |
87 // Returns the result code to return when breakpad failed to respawn a | 88 // Returns the result code to return when breakpad failed to respawn a |
88 // crashed process. | 89 // crashed process. |
89 virtual int GetResultCodeRespawnFailed(); | 90 virtual int GetResultCodeRespawnFailed(); |
90 | 91 |
91 // Invoked when initializing breakpad in the browser process. | 92 // Invoked when initializing the crash reporter in the browser process. |
92 virtual void InitBrowserCrashDumpsRegKey(); | 93 virtual void InitBrowserCrashDumpsRegKey(); |
93 | 94 |
94 // Invoked before attempting to write a minidump. | 95 // Invoked before attempting to write a minidump. |
95 virtual void RecordCrashDumpAttempt(bool is_real_crash); | 96 virtual void RecordCrashDumpAttempt(bool is_real_crash); |
96 #endif | 97 #endif |
97 | 98 |
98 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) | 99 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) |
99 // Returns a textual description of the product type and version to include | 100 // Returns a textual description of the product type and version to include |
100 // in the crash report. | 101 // in the crash report. |
101 virtual void GetProductNameAndVersion(std::string* product_name, | 102 virtual void GetProductNameAndVersion(std::string* product_name, |
(...skipping 10 matching lines...) Expand all Loading... |
112 // reporting server. Returns the size of the union of all keys. | 113 // reporting server. Returns the size of the union of all keys. |
113 virtual size_t RegisterCrashKeys(); | 114 virtual size_t RegisterCrashKeys(); |
114 | 115 |
115 // Returns true if running in unattended mode (for automated testing). | 116 // Returns true if running in unattended mode (for automated testing). |
116 virtual bool IsRunningUnattended(); | 117 virtual bool IsRunningUnattended(); |
117 | 118 |
118 // Returns true if the user has given consent to collect stats. | 119 // Returns true if the user has given consent to collect stats. |
119 virtual bool GetCollectStatsConsent(); | 120 virtual bool GetCollectStatsConsent(); |
120 | 121 |
121 #if defined(OS_WIN) || defined(OS_MACOSX) | 122 #if defined(OS_WIN) || defined(OS_MACOSX) |
122 // Returns true if breakpad is enforced via management policies. In that | 123 // Returns true if crash reporting is enforced via management policies. In |
123 // case, |breakpad_enabled| is set to the value enforced by policies. | 124 // that case, |breakpad_enabled| is set to the value enforced by policies. |
124 virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); | 125 virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); |
125 #endif | 126 #endif |
126 | 127 |
127 #if defined(OS_ANDROID) | 128 #if defined(OS_ANDROID) |
128 // Returns the descriptor key of the android minidump global descriptor. | 129 // Returns the descriptor key of the android minidump global descriptor. |
129 virtual int GetAndroidMinidumpDescriptor(); | 130 virtual int GetAndroidMinidumpDescriptor(); |
130 #endif | 131 #endif |
131 | 132 |
132 #if defined(OS_MACOSX) | 133 #if defined(OS_MACOSX) |
133 // Install additional breakpad filter callbacks. | 134 // Install additional breakpad filter callbacks. |
134 virtual void InstallAdditionalFilters(BreakpadRef breakpad); | 135 virtual void InstallAdditionalFilters(BreakpadRef breakpad); |
135 #endif | 136 #endif |
136 | 137 |
137 // Returns true if breakpad should run in the given process type. | 138 // Returns true if breakpad should run in the given process type. |
138 virtual bool EnableBreakpadForProcess(const std::string& process_type); | 139 virtual bool EnableBreakpadForProcess(const std::string& process_type); |
139 }; | 140 }; |
140 | 141 |
141 } // namespace breakpad | 142 } // namespace crash_reporter |
142 | 143 |
143 #endif // COMPONENTS_CRASH_APP_BREAKPAD_CLIENT_H_ | 144 #endif // COMPONENTS_CRASH_APP_CRASH_REPORTER_CLIENT_H_ |
OLD | NEW |