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"
16 namespace crash_keys
{
18 // Registers all of the potential crash keys that can be sent to the crash
19 // reporting server. Returns the size of the union of all keys.
20 size_t RegisterChromeCrashKeys();
22 // Sets the GUID by which this crash reporting client can be identified.
23 void SetClientID(const std::string
& client_id
);
25 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
26 void SetSwitchesFromCommandLine(const CommandLine
* command_line
);
28 // Sets the list of active experiment/variations info.
29 void SetVariationsList(const std::vector
<std::string
>& variations
);
31 // Sets the list of "active" extensions in this process. We overload "active" to
32 // mean different things depending on the process type:
33 // - browser: all enabled extensions
34 // - renderer: the unique set of extension ids from all content scripts
35 // - extension: the id of each extension running in this process (there can be
36 // multiple because of process collapsing).
37 void SetActiveExtensions(const std::set
<std::string
>& extensions
);
39 // Sets the printer info. Data should be separated by ';' up to
40 // kPrinterInfoCount substrings. Each substring will be truncated if necessary.
41 class ScopedPrinterInfo
{
43 explicit ScopedPrinterInfo(const base::StringPiece
& data
);
47 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo
);
50 // Crash Key Name Constants ////////////////////////////////////////////////////
52 // The GUID used to identify this client to the crash system.
53 extern const char kClientID
[];
55 // The product release/distribution channel.
56 extern const char kChannel
[];
58 // The URL of the active tab.
59 extern const char kActiveURL
[];
61 // Process command line switches. |kSwitch| should be formatted with an integer,
62 // in the range [1, kSwitchesMaxCount].
63 const size_t kSwitchesMaxCount
= 15;
64 extern const char kSwitch
[];
65 // The total number of switches, used to report the total in case more than
66 // |kSwitchesMaxCount| are present.
67 extern const char kNumSwitches
[];
69 // The total number of experiments the instance has.
70 extern const char kNumVariations
[];
71 // The experiments chunk. Hashed experiment names separated by |,|. This is
72 // typically set by SetExperimentList.
73 extern const char kVariations
[];
75 // Installed extensions. |kExtensionID| should be formatted with an integer,
76 // in the range [0, kExtensionIDMaxCount).
77 const size_t kExtensionIDMaxCount
= 10;
78 extern const char kExtensionID
[];
79 // The total number of installed extensions, recorded in case it exceeds
80 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid
81 // a common->app dependency.
82 extern const char kNumExtensionsCount
[];
84 // The number of render views/tabs open in a renderer process.
85 extern const char kNumberOfViews
[];
87 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE,
88 // "exit" for BROWSER_EXIT, or "end" for END_SESSION.
89 extern const char kShutdownType
[];
92 #if !defined(OS_ANDROID)
93 extern const char kGPUVendorID
[];
94 extern const char kGPUDeviceID
[];
96 extern const char kGPUDriverVersion
[];
97 extern const char kGPUPixelShaderVersion
[];
98 extern const char kGPUVertexShaderVersion
[];
99 #if defined(OS_MACOSX)
100 extern const char kGPUGLVersion
[];
101 #elif defined(OS_POSIX)
102 extern const char kGPUVendor
[];
103 extern const char kGPURenderer
[];
106 // The user's printers, up to kPrinterInfoCount. Should be set with
107 // ScopedPrinterInfo.
108 const size_t kPrinterInfoCount
= 4;
109 extern const char kPrinterInfo
[];
111 #if defined(OS_CHROMEOS)
112 // The number of simultaneous users in multi profile sessions.
113 extern const char kNumberOfUsers
[];
115 // The name of an aura::Window which is still alive despite its ui::Layer being
117 // TODO(pkotwicz): Remove once crbug.com/338788 is resolved.
118 extern const char kNameOfWindowWithDestroyedLayer
[];
121 #if defined(OS_MACOSX)
124 // Used to report the first Cocoa/Mac NSException and its backtrace.
125 extern const char kFirstNSException
[];
126 extern const char kFirstNSExceptionTrace
[];
128 // Used to report the last Cocoa/Mac NSException and its backtrace.
129 extern const char kLastNSException
[];
130 extern const char kLastNSExceptionTrace
[];
132 // Records the current NSException as it is being created, and its backtrace.
133 extern const char kNSException
[];
134 extern const char kNSExceptionTrace
[];
136 // In the CrApplication, records information about the current event's
138 extern const char kSendAction
[];
140 // Records Cocoa zombie/used-after-freed objects that resulted in a
142 extern const char kZombie
[];
143 extern const char kZombieTrace
[];
148 } // namespace crash_keys
150 #endif // CHROME_COMMON_CRASH_KEYS_H_