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 #include "chrome/common/crash_keys.h" | 5 #include "chrome/common/crash_keys.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/installer/util/google_update_settings.h" | |
15 | 14 |
16 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
17 #include "breakpad/src/common/simple_string_dictionary.h" | 16 #include "breakpad/src/common/simple_string_dictionary.h" |
18 #elif defined(OS_WIN) | 17 #elif defined(OS_WIN) |
19 #include "breakpad/src/client/windows/common/ipc_protocol.h" | 18 #include "breakpad/src/client/windows/common/ipc_protocol.h" |
20 #elif defined(OS_CHROMEOS) | 19 #elif defined(OS_CHROMEOS) |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "gpu/command_buffer/service/gpu_switches.h" | 21 #include "gpu/command_buffer/service/gpu_switches.h" |
23 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
24 #endif | 23 #endif |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 DCHECK_GT(n, 0); | 217 DCHECK_GT(n, 0); |
219 base::debug::CrashKey crash_key = { formatted_keys[i], kSmallSize }; | 218 base::debug::CrashKey crash_key = { formatted_keys[i], kSmallSize }; |
220 keys.push_back(crash_key); | 219 keys.push_back(crash_key); |
221 } | 220 } |
222 } | 221 } |
223 | 222 |
224 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), | 223 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), |
225 kSingleChunkLength); | 224 kSingleChunkLength); |
226 } | 225 } |
227 | 226 |
228 void SetClientID(const std::string& client_id) { | 227 void SetClientIDFromGUID(const std::string& client_guid) { |
229 std::string guid(client_id); | 228 std::string stripped_guid(client_guid); |
230 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. | 229 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. |
Ilya Sherman
2014/07/08 03:21:38
nit: "instance" -> "instances"
gab
2014/07/08 18:42:23
Done.
| |
231 ReplaceSubstringsAfterOffset(&guid, 0, "-", ""); | 230 ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", ""); |
232 if (guid.empty()) | 231 if (stripped_guid.empty()) |
233 return; | 232 return; |
234 | 233 |
235 base::debug::SetCrashKeyValue(kClientID, guid); | 234 base::debug::SetCrashKeyValue(kClientID, stripped_guid); |
236 GoogleUpdateSettings::SetMetricsId(guid); | |
Ilya Sherman
2014/07/08 03:21:38
Why is this line safe to remove? Are you sure tha
gab
2014/07/08 18:42:23
No it's not needed from the other call and yes thi
| |
237 } | 235 } |
238 | 236 |
239 static bool IsBoringSwitch(const std::string& flag) { | 237 static bool IsBoringSwitch(const std::string& flag) { |
240 #if defined(OS_WIN) | 238 #if defined(OS_WIN) |
241 return StartsWithASCII(flag, "--channel=", true) || | 239 return StartsWithASCII(flag, "--channel=", true) || |
242 | 240 |
243 // No point to including this since we already have a ptype field. | 241 // No point to including this since we already have a ptype field. |
244 StartsWithASCII(flag, "--type=", true) || | 242 StartsWithASCII(flag, "--type=", true) || |
245 | 243 |
246 // Not particularly interesting | 244 // Not particularly interesting |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 } | 393 } |
396 | 394 |
397 ScopedPrinterInfo::~ScopedPrinterInfo() { | 395 ScopedPrinterInfo::~ScopedPrinterInfo() { |
398 for (size_t i = 0; i < kPrinterInfoCount; ++i) { | 396 for (size_t i = 0; i < kPrinterInfoCount; ++i) { |
399 std::string key = base::StringPrintf(kPrinterInfo, i + 1); | 397 std::string key = base::StringPrintf(kPrinterInfo, i + 1); |
400 base::debug::ClearCrashKey(key); | 398 base::debug::ClearCrashKey(key); |
401 } | 399 } |
402 } | 400 } |
403 | 401 |
404 } // namespace crash_keys | 402 } // namespace crash_keys |
OLD | NEW |