Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / crash_keys.h
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.
4
5 #ifndef CHROME_COMMON_CRASH_KEYS_H_
6 #define CHROME_COMMON_CRASH_KEYS_H_
7
8 #include <set>
9 #include <string>
10 #include <vector>
11
12 #include "base/debug/crash_logging.h"
13
14 class CommandLine;
15
16 namespace crash_keys {
17
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();
21
22 // Sets the GUID by which this crash reporting client can be identified.
23 void SetClientID(const std::string& client_id);
24
25 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
26 void SetSwitchesFromCommandLine(const CommandLine* command_line);
27
28 // Sets the list of active experiment/variations info.
29 void SetVariationsList(const std::vector<std::string>& variations);
30
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);
38
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();
45
46  private:
47   DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo);
48 };
49
50 // Crash Key Name Constants ////////////////////////////////////////////////////
51
52 // The GUID used to identify this client to the crash system.
53 extern const char kClientID[];
54
55 // The product release/distribution channel.
56 extern const char kChannel[];
57
58 // The URL of the active tab.
59 extern const char kActiveURL[];
60
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[];
68
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[];
74
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[];
83
84 // The number of render views/tabs open in a renderer process.
85 extern const char kNumberOfViews[];
86
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[];
90
91 // GPU information.
92 #if !defined(OS_ANDROID)
93 extern const char kGPUVendorID[];
94 extern const char kGPUDeviceID[];
95 #endif
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[];
104 #endif
105
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[];
110
111 #if defined(OS_CHROMEOS)
112 // The number of simultaneous users in multi profile sessions.
113 extern const char kNumberOfUsers[];
114 #endif
115
116 #if defined(OS_MACOSX)
117 namespace mac {
118
119 // Used to report the first Cocoa/Mac NSException and its backtrace.
120 extern const char kFirstNSException[];
121 extern const char kFirstNSExceptionTrace[];
122
123 // Used to report the last Cocoa/Mac NSException and its backtrace.
124 extern const char kLastNSException[];
125 extern const char kLastNSExceptionTrace[];
126
127 // Records the current NSException as it is being created, and its backtrace.
128 extern const char kNSException[];
129 extern const char kNSExceptionTrace[];
130
131 // In the CrApplication, records information about the current event's
132 // target-action.
133 extern const char kSendAction[];
134
135 // Records Cocoa zombie/used-after-freed objects that resulted in a
136 // deliberate crash.
137 extern const char kZombie[];
138 extern const char kZombieTrace[];
139
140 }  // namespace mac
141 #endif
142
143 }  // namespace crash_keys
144
145 #endif  // CHROME_COMMON_CRASH_KEYS_H_