OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CHROME_COMMON_CRASH_KEYS_H_ | 5 #ifndef CHROME_COMMON_CRASH_KEYS_H_ |
6 #define CHROME_COMMON_CRASH_KEYS_H_ | 6 #define CHROME_COMMON_CRASH_KEYS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/debug/crash_logging.h" | 12 #include "base/debug/crash_logging.h" |
| 13 #include "components/crash_keys/crash_keys.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class CommandLine; | 16 class CommandLine; |
16 } | 17 } |
17 | 18 |
18 namespace crash_keys { | 19 namespace crash_keys { |
19 | 20 |
20 // Registers all of the potential crash keys that can be sent to the crash | 21 // Registers all of the potential crash keys that can be sent to the crash |
21 // reporting server. Returns the size of the union of all keys. | 22 // reporting server. Returns the size of the union of all keys. |
22 size_t RegisterChromeCrashKeys(); | 23 size_t RegisterChromeCrashKeys(); |
23 | 24 |
24 // Sets the ID (which may either be a full GUID or a GUID that was already | |
25 // stripped from its dashes -- in either case this method will strip remaining | |
26 // dashes before setting the crash key). | |
27 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid); | |
28 void ClearMetricsClientId(); | |
29 | |
30 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. | 25 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. |
31 void SetSwitchesFromCommandLine(const base::CommandLine* command_line); | 26 void SetSwitchesFromCommandLine(const base::CommandLine* command_line); |
32 | 27 |
33 // Sets the list of active experiment/variations info. | |
34 void SetVariationsList(const std::vector<std::string>& variations); | |
35 | |
36 // Sets the list of "active" extensions in this process. We overload "active" to | 28 // Sets the list of "active" extensions in this process. We overload "active" to |
37 // mean different things depending on the process type: | 29 // mean different things depending on the process type: |
38 // - browser: all enabled extensions | 30 // - browser: all enabled extensions |
39 // - renderer: the unique set of extension ids from all content scripts | 31 // - renderer: the unique set of extension ids from all content scripts |
40 // - extension: the id of each extension running in this process (there can be | 32 // - extension: the id of each extension running in this process (there can be |
41 // multiple because of process collapsing). | 33 // multiple because of process collapsing). |
42 void SetActiveExtensions(const std::set<std::string>& extensions); | 34 void SetActiveExtensions(const std::set<std::string>& extensions); |
43 | 35 |
44 // Sets the printer info. Data should be separated by ';' up to | 36 // Sets the printer info. Data should be separated by ';' up to |
45 // kPrinterInfoCount substrings. Each substring will be truncated if necessary. | 37 // kPrinterInfoCount substrings. Each substring will be truncated if necessary. |
46 class ScopedPrinterInfo { | 38 class ScopedPrinterInfo { |
47 public: | 39 public: |
48 explicit ScopedPrinterInfo(const base::StringPiece& data); | 40 explicit ScopedPrinterInfo(const base::StringPiece& data); |
49 ~ScopedPrinterInfo(); | 41 ~ScopedPrinterInfo(); |
50 | 42 |
51 private: | 43 private: |
52 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo); | 44 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo); |
53 }; | 45 }; |
54 | 46 |
55 // Crash Key Name Constants //////////////////////////////////////////////////// | 47 // Crash Key Name Constants //////////////////////////////////////////////////// |
56 | 48 |
57 // The GUID used to identify this client to the crash system. | |
58 #if defined(OS_MACOSX) | |
59 // On Mac OS X, the crash reporting client ID is the responsibility of Crashpad. | |
60 // It is not set directly by Chrome. To make the metrics client ID available on | |
61 // the server, it's stored in a distinct key. | |
62 extern const char kMetricsClientID[]; | |
63 #else | |
64 // When using Breakpad instead of Crashpad, the crash reporting client ID is the | |
65 // same as the metrics client ID. | |
66 extern const char kClientID[]; | |
67 #endif | |
68 | |
69 // The product release/distribution channel. | |
70 extern const char kChannel[]; | |
71 | |
72 // The URL of the active tab. | 49 // The URL of the active tab. |
73 extern const char kActiveURL[]; | 50 extern const char kActiveURL[]; |
74 | 51 |
75 // Process command line switches. |kSwitch| should be formatted with an integer, | 52 // Process command line switches. |kSwitch| should be formatted with an integer, |
76 // in the range [1, kSwitchesMaxCount]. | 53 // in the range [1, kSwitchesMaxCount]. |
77 const size_t kSwitchesMaxCount = 15; | 54 const size_t kSwitchesMaxCount = 15; |
78 extern const char kSwitch[]; | 55 extern const char kSwitch[]; |
79 // The total number of switches, used to report the total in case more than | 56 // The total number of switches, used to report the total in case more than |
80 // |kSwitchesMaxCount| are present. | 57 // |kSwitchesMaxCount| are present. |
81 extern const char kNumSwitches[]; | 58 extern const char kNumSwitches[]; |
82 | 59 |
83 // The total number of experiments the instance has. | |
84 extern const char kNumVariations[]; | |
85 // The experiments chunk. Hashed experiment names separated by |,|. This is | |
86 // typically set by SetExperimentList. | |
87 extern const char kVariations[]; | |
88 | |
89 // Installed extensions. |kExtensionID| should be formatted with an integer, | 60 // Installed extensions. |kExtensionID| should be formatted with an integer, |
90 // in the range [0, kExtensionIDMaxCount). | 61 // in the range [0, kExtensionIDMaxCount). |
91 const size_t kExtensionIDMaxCount = 10; | 62 const size_t kExtensionIDMaxCount = 10; |
92 extern const char kExtensionID[]; | 63 extern const char kExtensionID[]; |
93 // The total number of installed extensions, recorded in case it exceeds | 64 // The total number of installed extensions, recorded in case it exceeds |
94 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid | 65 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid |
95 // a common->app dependency. | 66 // a common->app dependency. |
96 extern const char kNumExtensionsCount[]; | 67 extern const char kNumExtensionsCount[]; |
97 | 68 |
98 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE, | 69 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 extern const char kLastNSExceptionTrace[]; | 107 extern const char kLastNSExceptionTrace[]; |
137 | 108 |
138 // Records the current NSException as it is being created, and its backtrace. | 109 // Records the current NSException as it is being created, and its backtrace. |
139 extern const char kNSException[]; | 110 extern const char kNSException[]; |
140 extern const char kNSExceptionTrace[]; | 111 extern const char kNSExceptionTrace[]; |
141 | 112 |
142 // In the CrApplication, records information about the current event's | 113 // In the CrApplication, records information about the current event's |
143 // target-action. | 114 // target-action. |
144 extern const char kSendAction[]; | 115 extern const char kSendAction[]; |
145 | 116 |
146 // Records Cocoa zombie/used-after-freed objects that resulted in a | |
147 // deliberate crash. | |
148 extern const char kZombie[]; | |
149 extern const char kZombieTrace[]; | |
150 | |
151 } // namespace mac | 117 } // namespace mac |
152 #endif | 118 #endif |
153 | 119 |
154 #if defined(KASKO) | 120 #if defined(KASKO) |
155 // Used to correlate a report sent via Kasko with one sent via Breakpad. | 121 // Used to correlate a report sent via Kasko with one sent via Breakpad. |
156 extern const char kKaskoGuid[]; | 122 extern const char kKaskoGuid[]; |
157 extern const char kKaskoEquivalentGuid[]; | 123 extern const char kKaskoEquivalentGuid[]; |
158 #endif | 124 #endif |
159 | 125 |
160 // Numbers of active views. | 126 // Numbers of active views. |
161 extern const char kViewCount[]; | 127 extern const char kViewCount[]; |
162 | 128 |
163 } // namespace crash_keys | 129 } // namespace crash_keys |
164 | 130 |
165 #endif // CHROME_COMMON_CRASH_KEYS_H_ | 131 #endif // CHROME_COMMON_CRASH_KEYS_H_ |
OLD | NEW |