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 GUID by which this crash reporting client can be identified.
25 void SetClientID(const std::string
& client_id
);
27 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
28 void SetSwitchesFromCommandLine(const base::CommandLine
* command_line
);
30 // Sets the list of active experiment/variations info.
31 void SetVariationsList(const std::vector
<std::string
>& variations
);
33 // Sets the list of "active" extensions in this process. We overload "active" to
34 // mean different things depending on the process type:
35 // - browser: all enabled extensions
36 // - renderer: the unique set of extension ids from all content scripts
37 // - extension: the id of each extension running in this process (there can be
38 // multiple because of process collapsing).
39 void SetActiveExtensions(const std::set
<std::string
>& extensions
);
41 // Sets the printer info. Data should be separated by ';' up to
42 // kPrinterInfoCount substrings. Each substring will be truncated if necessary.
43 class ScopedPrinterInfo
{
45 explicit ScopedPrinterInfo(const base::StringPiece
& data
);
49 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo
);
52 // Crash Key Name Constants ////////////////////////////////////////////////////
54 // The GUID used to identify this client to the crash system.
55 extern const char kClientID
[];
57 // The product release/distribution channel.
58 extern const char kChannel
[];
60 // The URL of the active tab.
61 extern const char kActiveURL
[];
63 // Process command line switches. |kSwitch| should be formatted with an integer,
64 // in the range [1, kSwitchesMaxCount].
65 const size_t kSwitchesMaxCount
= 15;
66 extern const char kSwitch
[];
67 // The total number of switches, used to report the total in case more than
68 // |kSwitchesMaxCount| are present.
69 extern const char kNumSwitches
[];
71 // The total number of experiments the instance has.
72 extern const char kNumVariations
[];
73 // The experiments chunk. Hashed experiment names separated by |,|. This is
74 // typically set by SetExperimentList.
75 extern const char kVariations
[];
77 // Installed extensions. |kExtensionID| should be formatted with an integer,
78 // in the range [0, kExtensionIDMaxCount).
79 const size_t kExtensionIDMaxCount
= 10;
80 extern const char kExtensionID
[];
81 // The total number of installed extensions, recorded in case it exceeds
82 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid
83 // a common->app dependency.
84 extern const char kNumExtensionsCount
[];
86 // The number of render views/tabs open in a renderer process.
87 extern const char kNumberOfViews
[];
89 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE,
90 // "exit" for BROWSER_EXIT, or "end" for END_SESSION.
91 extern const char kShutdownType
[];
94 #if !defined(OS_ANDROID)
95 extern const char kGPUVendorID
[];
96 extern const char kGPUDeviceID
[];
98 extern const char kGPUDriverVersion
[];
99 extern const char kGPUPixelShaderVersion
[];
100 extern const char kGPUVertexShaderVersion
[];
101 #if defined(OS_MACOSX)
102 extern const char kGPUGLVersion
[];
103 #elif defined(OS_POSIX)
104 extern const char kGPUVendor
[];
105 extern const char kGPURenderer
[];
108 // The user's printers, up to kPrinterInfoCount. Should be set with
109 // ScopedPrinterInfo.
110 const size_t kPrinterInfoCount
= 4;
111 extern const char kPrinterInfo
[];
113 #if defined(OS_CHROMEOS)
114 // The number of simultaneous users in multi profile sessions.
115 extern const char kNumberOfUsers
[];
118 #if defined(OS_MACOSX)
121 // Used to report the first Cocoa/Mac NSException and its backtrace.
122 extern const char kFirstNSException
[];
123 extern const char kFirstNSExceptionTrace
[];
125 // Used to report the last Cocoa/Mac NSException and its backtrace.
126 extern const char kLastNSException
[];
127 extern const char kLastNSExceptionTrace
[];
129 // Records the current NSException as it is being created, and its backtrace.
130 extern const char kNSException
[];
131 extern const char kNSExceptionTrace
[];
133 // In the CrApplication, records information about the current event's
135 extern const char kSendAction
[];
137 // Records Cocoa zombie/used-after-freed objects that resulted in a
139 extern const char kZombie
[];
140 extern const char kZombieTrace
[];
145 } // namespace crash_keys
147 #endif // CHROME_COMMON_CRASH_KEYS_H_