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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_CRASH_KEYS_H_
6 #define CHROME_COMMON_CRASH_KEYS_H_
12 #include "base/debug/crash_logging.h"
18 namespace crash_keys
{
20 // 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 size_t RegisterChromeCrashKeys();
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();
30 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
31 void SetSwitchesFromCommandLine(const base::CommandLine
* command_line
);
33 // Sets the list of active experiment/variations info.
34 void SetVariationsList(const std::vector
<std::string
>& variations
);
36 // Sets the list of "active" extensions in this process. We overload "active" to
37 // mean different things depending on the process type:
38 // - browser: all enabled extensions
39 // - 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
41 // multiple because of process collapsing).
42 void SetActiveExtensions(const std::set
<std::string
>& extensions
);
44 // Sets the printer info. Data should be separated by ';' up to
45 // kPrinterInfoCount substrings. Each substring will be truncated if necessary.
46 class ScopedPrinterInfo
{
48 explicit ScopedPrinterInfo(const base::StringPiece
& data
);
52 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo
);
55 // Crash Key Name Constants ////////////////////////////////////////////////////
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
[];
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
[];
69 // The product release/distribution channel.
70 extern const char kChannel
[];
72 // The URL of the active tab.
73 extern const char kActiveURL
[];
75 // Process command line switches. |kSwitch| should be formatted with an integer,
76 // in the range [1, kSwitchesMaxCount].
77 const size_t kSwitchesMaxCount
= 15;
78 extern const char kSwitch
[];
79 // The total number of switches, used to report the total in case more than
80 // |kSwitchesMaxCount| are present.
81 extern const char kNumSwitches
[];
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
[];
89 // Installed extensions. |kExtensionID| should be formatted with an integer,
90 // in the range [0, kExtensionIDMaxCount).
91 const size_t kExtensionIDMaxCount
= 10;
92 extern const char kExtensionID
[];
93 // The total number of installed extensions, recorded in case it exceeds
94 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid
95 // a common->app dependency.
96 extern const char kNumExtensionsCount
[];
98 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE,
99 // "exit" for BROWSER_EXIT, or "end" for END_SESSION.
100 extern const char kShutdownType
[];
103 #if !defined(OS_ANDROID)
104 extern const char kGPUVendorID
[];
105 extern const char kGPUDeviceID
[];
107 extern const char kGPUDriverVersion
[];
108 extern const char kGPUPixelShaderVersion
[];
109 extern const char kGPUVertexShaderVersion
[];
110 #if defined(OS_MACOSX)
111 extern const char kGPUGLVersion
[];
112 #elif defined(OS_POSIX)
113 extern const char kGPUVendor
[];
114 extern const char kGPURenderer
[];
117 // The user's printers, up to kPrinterInfoCount. Should be set with
118 // ScopedPrinterInfo.
119 const size_t kPrinterInfoCount
= 4;
120 extern const char kPrinterInfo
[];
122 #if defined(OS_CHROMEOS)
123 // The number of simultaneous users in multi profile sessions.
124 extern const char kNumberOfUsers
[];
127 #if defined(OS_MACOSX)
130 // Used to report the first Cocoa/Mac NSException and its backtrace.
131 extern const char kFirstNSException
[];
132 extern const char kFirstNSExceptionTrace
[];
134 // Used to report the last Cocoa/Mac NSException and its backtrace.
135 extern const char kLastNSException
[];
136 extern const char kLastNSExceptionTrace
[];
138 // Records the current NSException as it is being created, and its backtrace.
139 extern const char kNSException
[];
140 extern const char kNSExceptionTrace
[];
142 // In the CrApplication, records information about the current event's
144 extern const char kSendAction
[];
146 // Records Cocoa zombie/used-after-freed objects that resulted in a
148 extern const char kZombie
[];
149 extern const char kZombieTrace
[];
155 // Used to correlate a report sent via Kasko with one sent via Breakpad.
156 extern const char kKaskoGuid
[];
157 extern const char kKaskoEquivalentGuid
[];
160 // Numbers of active views.
161 extern const char kViewCount
[];
163 } // namespace crash_keys
165 #endif // CHROME_COMMON_CRASH_KEYS_H_