Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / crash_keys.h
blob9e20f4a6ffd632162a15d6ce6db3e70a971e2504
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_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/debug/crash_logging.h"
14 class CommandLine;
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 {
42 public:
43 explicit ScopedPrinterInfo(const base::StringPiece& data);
44 ~ScopedPrinterInfo();
46 private:
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 // GPU information.
88 #if !defined(OS_ANDROID)
89 extern const char kGPUVendorID[];
90 extern const char kGPUDeviceID[];
91 #endif
92 extern const char kGPUDriverVersion[];
93 extern const char kGPUPixelShaderVersion[];
94 extern const char kGPUVertexShaderVersion[];
95 #if defined(OS_MACOSX)
96 extern const char kGPUGLVersion[];
97 #elif defined(OS_POSIX)
98 extern const char kGPUVendor[];
99 extern const char kGPURenderer[];
100 #endif
102 // The user's printers, up to kPrinterInfoCount. Should be set with
103 // ScopedPrinterInfo.
104 const size_t kPrinterInfoCount = 4;
105 extern const char kPrinterInfo[];
107 #if defined(OS_CHROMEOS)
108 // The number of simultaneous users in multi profile sessions.
109 extern const char kNumberOfUsers[];
110 #endif
112 #if defined(OS_MACOSX)
113 namespace mac {
115 // Used to report the first Cocoa/Mac NSException and its backtrace.
116 extern const char kFirstNSException[];
117 extern const char kFirstNSExceptionTrace[];
119 // Used to report the last Cocoa/Mac NSException and its backtrace.
120 extern const char kLastNSException[];
121 extern const char kLastNSExceptionTrace[];
123 // Records the current NSException as it is being created, and its backtrace.
124 extern const char kNSException[];
125 extern const char kNSExceptionTrace[];
127 // In the CrApplication, records information about the current event's
128 // target-action.
129 extern const char kSendAction[];
131 // Records Cocoa zombie/used-after-freed objects that resulted in a
132 // deliberate crash.
133 extern const char kZombie[];
134 extern const char kZombieTrace[];
136 } // namespace mac
137 #endif
139 } // namespace crash_keys
141 #endif // CHROME_COMMON_CRASH_KEYS_H_