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"
13 #include "components/crash_keys/crash_keys.h"
19 namespace crash_keys
{
21 // Registers all of the potential crash keys that can be sent to the crash
22 // reporting server. Returns the size of the union of all keys.
23 size_t RegisterChromeCrashKeys();
25 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
26 void SetSwitchesFromCommandLine(const base::CommandLine
* command_line
);
28 // Sets the list of "active" extensions in this process. We overload "active" to
29 // mean different things depending on the process type:
30 // - browser: all enabled extensions
31 // - renderer: the unique set of extension ids from all content scripts
32 // - extension: the id of each extension running in this process (there can be
33 // multiple because of process collapsing).
34 void SetActiveExtensions(const std::set
<std::string
>& extensions
);
36 // Sets the printer info. Data should be separated by ';' up to
37 // kPrinterInfoCount substrings. Each substring will be truncated if necessary.
38 class ScopedPrinterInfo
{
40 explicit ScopedPrinterInfo(const base::StringPiece
& data
);
44 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo
);
47 // Crash Key Name Constants ////////////////////////////////////////////////////
49 // The URL of the active tab.
50 extern const char kActiveURL
[];
52 // Process command line switches. |kSwitch| should be formatted with an integer,
53 // in the range [1, kSwitchesMaxCount].
54 const size_t kSwitchesMaxCount
= 15;
55 extern const char kSwitch
[];
56 // The total number of switches, used to report the total in case more than
57 // |kSwitchesMaxCount| are present.
58 extern const char kNumSwitches
[];
60 // Installed extensions. |kExtensionID| should be formatted with an integer,
61 // in the range [0, kExtensionIDMaxCount).
62 const size_t kExtensionIDMaxCount
= 10;
63 extern const char kExtensionID
[];
64 // The total number of installed extensions, recorded in case it exceeds
65 // kExtensionIDMaxCount. Also used in chrome/app, but defined here to avoid
66 // a common->app dependency.
67 extern const char kNumExtensionsCount
[];
69 // Type of shutdown. The value is one of "close" for WINDOW_CLOSE,
70 // "exit" for BROWSER_EXIT, or "end" for END_SESSION.
71 extern const char kShutdownType
[];
74 #if !defined(OS_ANDROID)
75 extern const char kGPUVendorID
[];
76 extern const char kGPUDeviceID
[];
78 extern const char kGPUDriverVersion
[];
79 extern const char kGPUPixelShaderVersion
[];
80 extern const char kGPUVertexShaderVersion
[];
81 #if defined(OS_MACOSX)
82 extern const char kGPUGLVersion
[];
83 #elif defined(OS_POSIX)
84 extern const char kGPUVendor
[];
85 extern const char kGPURenderer
[];
88 // The user's printers, up to kPrinterInfoCount. Should be set with
90 const size_t kPrinterInfoCount
= 4;
91 extern const char kPrinterInfo
[];
93 #if defined(OS_CHROMEOS)
94 // The number of simultaneous users in multi profile sessions.
95 extern const char kNumberOfUsers
[];
98 #if defined(OS_MACOSX)
101 // Used to report the first Cocoa/Mac NSException and its backtrace.
102 extern const char kFirstNSException
[];
103 extern const char kFirstNSExceptionTrace
[];
105 // Used to report the last Cocoa/Mac NSException and its backtrace.
106 extern const char kLastNSException
[];
107 extern const char kLastNSExceptionTrace
[];
109 // Records the current NSException as it is being created, and its backtrace.
110 extern const char kNSException
[];
111 extern const char kNSExceptionTrace
[];
113 // In the CrApplication, records information about the current event's
115 extern const char kSendAction
[];
121 // Used to correlate a report sent via Kasko with one sent via Breakpad.
122 extern const char kKaskoGuid
[];
123 extern const char kKaskoEquivalentGuid
[];
126 // Numbers of active views.
127 extern const char kViewCount
[];
129 } // namespace crash_keys
131 #endif // CHROME_COMMON_CRASH_KEYS_H_