OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_CRASH_KEYS_H_ | 5 #ifndef CHROME_COMMON_CRASH_KEYS_H_ |
6 #define CHROME_COMMON_CRASH_KEYS_H_ | 6 #define CHROME_COMMON_CRASH_KEYS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/debug/crash_logging.h" | 12 #include "base/debug/crash_logging.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class CommandLine; | 15 class CommandLine; |
16 } | 16 } |
17 | 17 |
18 namespace crash_keys { | 18 namespace crash_keys { |
19 | 19 |
20 // Registers all of the potential crash keys that can be sent to the crash | 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. | 21 // reporting server. Returns the size of the union of all keys. |
22 size_t RegisterChromeCrashKeys(); | 22 size_t RegisterChromeCrashKeys(); |
23 | 23 |
24 // Sets the ID (based on |client_guid| which may either be a full GUID or a | 24 // Sets the ID (which may either be a full GUID or a GUID that was already |
25 // GUID that was already stripped from its dashes -- in either cases this method | 25 // stripped from its dashes -- in either case this method will strip remaining |
26 // will strip remaining dashes before setting the crash key) by which this crash | 26 // dashes before setting the crash key) by which this crash reporting client can |
27 // reporting client can be identified. | 27 // be identified. |
| 28 #if defined(OS_MACOSX) |
| 29 // Under Crashpad, the crash client ID is Crashpad's responsibility, and cannot |
| 30 // be set directly by Chrome. The metrics client ID is distinct from the crash |
| 31 // client ID and is set as a crash key. When metrics recording is disabled, the |
| 32 // metrics client ID will be cleared. |
| 33 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid); |
| 34 void ClearMetricsClientId(); |
| 35 #else |
| 36 // Under Breakpad, the crash client ID and the metrics client ID are the same. |
28 void SetCrashClientIdFromGUID(const std::string& client_guid); | 37 void SetCrashClientIdFromGUID(const std::string& client_guid); |
| 38 #endif |
29 | 39 |
30 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. | 40 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. |
31 void SetSwitchesFromCommandLine(const base::CommandLine* command_line); | 41 void SetSwitchesFromCommandLine(const base::CommandLine* command_line); |
32 | 42 |
33 // Sets the list of active experiment/variations info. | 43 // Sets the list of active experiment/variations info. |
34 void SetVariationsList(const std::vector<std::string>& variations); | 44 void SetVariationsList(const std::vector<std::string>& variations); |
35 | 45 |
36 // Sets the list of "active" extensions in this process. We overload "active" to | 46 // Sets the list of "active" extensions in this process. We overload "active" to |
37 // mean different things depending on the process type: | 47 // mean different things depending on the process type: |
38 // - browser: all enabled extensions | 48 // - browser: all enabled extensions |
39 // - renderer: the unique set of extension ids from all content scripts | 49 // - renderer: the unique set of extension ids from all content scripts |
40 // - extension: the id of each extension running in this process (there can be | 50 // - extension: the id of each extension running in this process (there can be |
41 // multiple because of process collapsing). | 51 // multiple because of process collapsing). |
42 void SetActiveExtensions(const std::set<std::string>& extensions); | 52 void SetActiveExtensions(const std::set<std::string>& extensions); |
43 | 53 |
44 // Sets the printer info. Data should be separated by ';' up to | 54 // Sets the printer info. Data should be separated by ';' up to |
45 // kPrinterInfoCount substrings. Each substring will be truncated if necessary. | 55 // kPrinterInfoCount substrings. Each substring will be truncated if necessary. |
46 class ScopedPrinterInfo { | 56 class ScopedPrinterInfo { |
47 public: | 57 public: |
48 explicit ScopedPrinterInfo(const base::StringPiece& data); | 58 explicit ScopedPrinterInfo(const base::StringPiece& data); |
49 ~ScopedPrinterInfo(); | 59 ~ScopedPrinterInfo(); |
50 | 60 |
51 private: | 61 private: |
52 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo); | 62 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfo); |
53 }; | 63 }; |
54 | 64 |
55 // Crash Key Name Constants //////////////////////////////////////////////////// | 65 // Crash Key Name Constants //////////////////////////////////////////////////// |
56 | 66 |
57 // The GUID used to identify this client to the crash system. | 67 #if defined(OS_MACOSX) |
| 68 // The GUID used to identify this client to the crash system. On Mac OS X, this |
| 69 // is the responsibility of Crashpad, and is not set directly by Chrome. |
| 70 extern const char kMetricsClientID[]; |
| 71 #else |
58 extern const char kClientID[]; | 72 extern const char kClientID[]; |
| 73 #endif |
59 | 74 |
60 // The product release/distribution channel. | 75 // The product release/distribution channel. |
61 extern const char kChannel[]; | 76 extern const char kChannel[]; |
62 | 77 |
63 // The URL of the active tab. | 78 // The URL of the active tab. |
64 extern const char kActiveURL[]; | 79 extern const char kActiveURL[]; |
65 | 80 |
66 // Process command line switches. |kSwitch| should be formatted with an integer, | 81 // Process command line switches. |kSwitch| should be formatted with an integer, |
67 // in the range [1, kSwitchesMaxCount]. | 82 // in the range [1, kSwitchesMaxCount]. |
68 const size_t kSwitchesMaxCount = 15; | 83 const size_t kSwitchesMaxCount = 15; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 159 |
145 #if defined(KASKO) | 160 #if defined(KASKO) |
146 // Used to correlate a report sent via Kasko with one sent via Breakpad. | 161 // Used to correlate a report sent via Kasko with one sent via Breakpad. |
147 extern const char kKaskoGuid[]; | 162 extern const char kKaskoGuid[]; |
148 extern const char kKaskoEquivalentGuid[]; | 163 extern const char kKaskoEquivalentGuid[]; |
149 #endif | 164 #endif |
150 | 165 |
151 } // namespace crash_keys | 166 } // namespace crash_keys |
152 | 167 |
153 #endif // CHROME_COMMON_CRASH_KEYS_H_ | 168 #endif // CHROME_COMMON_CRASH_KEYS_H_ |
OLD | NEW |