OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/crash/content/app/crash_keys_win.h" | 5 #include "components/crash/content/app/crash_keys_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
13 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
15 #include "breakpad/src/client/windows/common/ipc_protocol.h" | 14 #include "breakpad/src/client/windows/common/ipc_protocol.h" |
16 #include "components/crash/content/app/crash_reporter_client.h" | 15 #include "components/crash/content/app/crash_reporter_client.h" |
17 | 16 |
18 namespace breakpad { | 17 namespace breakpad { |
19 | 18 |
20 using crash_reporter::CrashReporterClient; | 19 using crash_reporter::CrashReporterClient; |
21 | 20 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 custom_entries_->push_back(google_breakpad::CustomInfoEntry( | 61 custom_entries_->push_back(google_breakpad::CustomInfoEntry( |
63 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(), | 62 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(), |
64 path.substr(chunk_start, chunk_length).c_str())); | 63 path.substr(chunk_start, chunk_length).c_str())); |
65 | 64 |
66 chunk_start += chunk_length; | 65 chunk_start += chunk_length; |
67 } | 66 } |
68 } | 67 } |
69 | 68 |
70 // Appends the breakpad dump path to |g_custom_entries|. | 69 // Appends the breakpad dump path to |g_custom_entries|. |
71 void CrashKeysWin::SetBreakpadDumpPath(CrashReporterClient* crash_client) { | 70 void CrashKeysWin::SetBreakpadDumpPath(CrashReporterClient* crash_client) { |
72 base::FilePath crash_dumps_dir_path; | 71 base::string16 crash_dumps_dir_path; |
73 if (crash_client->GetAlternativeCrashDumpLocation(&crash_dumps_dir_path)) { | 72 if (crash_client->GetAlternativeCrashDumpLocation(&crash_dumps_dir_path)) { |
74 custom_entries_->push_back(google_breakpad::CustomInfoEntry( | 73 custom_entries_->push_back(google_breakpad::CustomInfoEntry( |
75 L"breakpad-dump-location", crash_dumps_dir_path.value().c_str())); | 74 L"breakpad-dump-location", crash_dumps_dir_path.c_str())); |
76 } | 75 } |
77 } | 76 } |
78 | 77 |
79 // Returns the custom info structure based on the dll in parameter and the | 78 // Returns the custom info structure based on the dll in parameter and the |
80 // process type. | 79 // process type. |
81 google_breakpad::CustomClientInfo* | 80 google_breakpad::CustomClientInfo* |
82 CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, | 81 CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, |
83 const std::wstring& type, | 82 const std::wstring& type, |
84 const std::wstring& profile_type, | 83 const std::wstring& profile_type, |
85 base::CommandLine* cmd_line, | 84 base::CommandLine* cmd_line, |
86 CrashReporterClient* crash_client) { | 85 CrashReporterClient* crash_client) { |
87 base::string16 version, product; | 86 base::string16 version, product; |
88 base::string16 special_build; | 87 base::string16 special_build; |
89 base::string16 channel_name; | 88 base::string16 channel_name; |
90 | 89 |
91 crash_client->GetProductNameAndVersion( | 90 crash_client->GetProductNameAndVersion( |
92 base::FilePath(exe_path), | 91 exe_path, |
93 &product, | 92 &product, |
94 &version, | 93 &version, |
95 &special_build, | 94 &special_build, |
96 &channel_name); | 95 &channel_name); |
97 | 96 |
98 // We only expect this method to be called once per process. | 97 // We only expect this method to be called once per process. |
99 // Common enties | 98 // Common enties |
100 custom_entries_->push_back( | 99 custom_entries_->push_back( |
101 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); | 100 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); |
102 custom_entries_->push_back( | 101 custom_entries_->push_back( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 185 |
187 std::wstring key_string(key); | 186 std::wstring key_string(key); |
188 DynamicEntriesMap::iterator it = dynamic_entries_.find(key_string); | 187 DynamicEntriesMap::iterator it = dynamic_entries_.find(key_string); |
189 if (it == dynamic_entries_.end()) | 188 if (it == dynamic_entries_.end()) |
190 return; | 189 return; |
191 | 190 |
192 it->second->set_value(NULL); | 191 it->second->set_value(NULL); |
193 } | 192 } |
194 | 193 |
195 } // namespace breakpad | 194 } // namespace breakpad |
OLD | NEW |