Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: chrome/app/breakpad_win.cc

Issue 10740003: Send the user's Windows profile type up in crash reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/chrome_exe.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app/breakpad_win.h" 5 #include "chrome/app/breakpad_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <tchar.h> 9 #include <tchar.h>
10 #include <userenv.h>
10 11
11 #include <algorithm> 12 #include <algorithm>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/base_switches.h" 15 #include "base/base_switches.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/environment.h" 17 #include "base/environment.h"
17 #include "base/file_util.h" 18 #include "base/file_util.h"
18 #include "base/file_version_info.h" 19 #include "base/file_version_info.h"
19 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 size_t chunk_length = std::min(kChunkSize, path.size() - chunk_start); 215 size_t chunk_length = std::min(kChunkSize, path.size() - chunk_start);
215 216
216 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 217 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
217 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(), 218 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(),
218 path.substr(chunk_start, chunk_length).c_str())); 219 path.substr(chunk_start, chunk_length).c_str()));
219 220
220 chunk_start += chunk_length; 221 chunk_start += chunk_length;
221 } 222 }
222 } 223 }
223 224
225 // Returns a string containing a list of all modifiers for the loaded profile.
226 std::wstring GetProfileType() {
227 std::wstring profile_type;
228 DWORD profile_bits = 0;
229 if (::GetProfileType(&profile_bits)) {
Sigurður Ásgeirsson 2012/07/09 16:39:48 nit: is it useful to return a special string for f
grt (UTC plus 2) 2012/07/09 17:03:10 Good idea. PTAL.
230 static const struct {
231 DWORD bit;
232 const wchar_t* name;
233 } kBitNames[] = {
234 { PT_MANDATORY, L"mandatory" },
235 { PT_ROAMING, L"roaming" },
236 { PT_TEMPORARY, L"temporary" },
237 };
238 for (size_t i = 0; i < arraysize(kBitNames); ++i) {
239 const DWORD this_bit = kBitNames[i].bit;
240 if ((profile_bits & this_bit) != 0) {
241 profile_type.append(kBitNames[i].name);
242 profile_bits &= ~this_bit;
243 if (profile_bits != 0)
244 profile_type.append(L", ");
245 }
246 }
247 }
248 return profile_type;
249 }
250
224 // Returns the custom info structure based on the dll in parameter and the 251 // Returns the custom info structure based on the dll in parameter and the
225 // process type. 252 // process type.
226 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, 253 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
227 const std::wstring& type, 254 const std::wstring& type,
228 const std::wstring& channel) { 255 const std::wstring& channel) {
229 scoped_ptr<FileVersionInfo> 256 scoped_ptr<FileVersionInfo>
230 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); 257 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path)));
231 258
232 std::wstring version, product; 259 std::wstring version, product;
233 std::wstring special_build; 260 std::wstring special_build;
(...skipping 25 matching lines...) Expand all
259 g_custom_entries->push_back( 286 g_custom_entries->push_back(
260 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); 287 google_breakpad::CustomInfoEntry(L"ver", version.c_str()));
261 g_custom_entries->push_back( 288 g_custom_entries->push_back(
262 google_breakpad::CustomInfoEntry(L"prod", product.c_str())); 289 google_breakpad::CustomInfoEntry(L"prod", product.c_str()));
263 g_custom_entries->push_back( 290 g_custom_entries->push_back(
264 google_breakpad::CustomInfoEntry(L"plat", L"Win32")); 291 google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
265 g_custom_entries->push_back( 292 g_custom_entries->push_back(
266 google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); 293 google_breakpad::CustomInfoEntry(L"ptype", type.c_str()));
267 g_custom_entries->push_back( 294 g_custom_entries->push_back(
268 google_breakpad::CustomInfoEntry(L"channel", channel.c_str())); 295 google_breakpad::CustomInfoEntry(L"channel", channel.c_str()));
296 g_custom_entries->push_back(
297 google_breakpad::CustomInfoEntry(L"profile-type",
298 GetProfileType().c_str()));
269 299
270 if (!special_build.empty()) 300 if (!special_build.empty())
271 g_custom_entries->push_back( 301 g_custom_entries->push_back(
272 google_breakpad::CustomInfoEntry(L"special", special_build.c_str())); 302 google_breakpad::CustomInfoEntry(L"special", special_build.c_str()));
273 303
274 g_num_of_extensions_offset = g_custom_entries->size(); 304 g_num_of_extensions_offset = g_custom_entries->size();
275 g_custom_entries->push_back( 305 g_custom_entries->push_back(
276 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); 306 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A"));
277 307
278 g_extension_ids_offset = g_custom_entries->size(); 308 g_extension_ids_offset = g_custom_entries->size();
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 previous_filter = SetUnhandledExceptionFilter(filter); 878 previous_filter = SetUnhandledExceptionFilter(filter);
849 } 879 }
850 880
851 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 881 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
852 std::vector<const wchar_t*>* cstrings) { 882 std::vector<const wchar_t*>* cstrings) {
853 cstrings->clear(); 883 cstrings->clear();
854 cstrings->reserve(wstrings.size()); 884 cstrings->reserve(wstrings.size());
855 for (size_t i = 0; i < wstrings.size(); ++i) 885 for (size_t i = 0; i < wstrings.size(); ++i)
856 cstrings->push_back(wstrings[i].c_str()); 886 cstrings->push_back(wstrings[i].c_str());
857 } 887 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_exe.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698