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

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

Issue 10704132: Revert 145892 - 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>
11 10
12 #include <algorithm> 11 #include <algorithm>
13 #include <vector> 12 #include <vector>
14 13
15 #include "base/base_switches.h" 14 #include "base/base_switches.h"
16 #include "base/command_line.h" 15 #include "base/command_line.h"
17 #include "base/environment.h" 16 #include "base/environment.h"
18 #include "base/file_util.h" 17 #include "base/file_util.h"
19 #include "base/file_version_info.h" 18 #include "base/file_version_info.h"
20 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 size_t chunk_length = std::min(kChunkSize, path.size() - chunk_start); 214 size_t chunk_length = std::min(kChunkSize, path.size() - chunk_start);
216 215
217 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 216 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
218 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(), 217 base::StringPrintf(L"plugin-path-chunk-%i", chunk_index + 1).c_str(),
219 path.substr(chunk_start, chunk_length).c_str())); 218 path.substr(chunk_start, chunk_length).c_str()));
220 219
221 chunk_start += chunk_length; 220 chunk_start += chunk_length;
222 } 221 }
223 } 222 }
224 223
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)) {
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 } else {
248 DWORD last_error = ::GetLastError();
249 base::SStringPrintf(&profile_type, L"error %u", last_error);
250 }
251 return profile_type;
252 }
253
254 // Returns the custom info structure based on the dll in parameter and the 224 // Returns the custom info structure based on the dll in parameter and the
255 // process type. 225 // process type.
256 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, 226 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
257 const std::wstring& type, 227 const std::wstring& type,
258 const std::wstring& channel) { 228 const std::wstring& channel) {
259 scoped_ptr<FileVersionInfo> 229 scoped_ptr<FileVersionInfo>
260 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); 230 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path)));
261 231
262 std::wstring version, product; 232 std::wstring version, product;
263 std::wstring special_build; 233 std::wstring special_build;
(...skipping 25 matching lines...) Expand all
289 g_custom_entries->push_back( 259 g_custom_entries->push_back(
290 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); 260 google_breakpad::CustomInfoEntry(L"ver", version.c_str()));
291 g_custom_entries->push_back( 261 g_custom_entries->push_back(
292 google_breakpad::CustomInfoEntry(L"prod", product.c_str())); 262 google_breakpad::CustomInfoEntry(L"prod", product.c_str()));
293 g_custom_entries->push_back( 263 g_custom_entries->push_back(
294 google_breakpad::CustomInfoEntry(L"plat", L"Win32")); 264 google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
295 g_custom_entries->push_back( 265 g_custom_entries->push_back(
296 google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); 266 google_breakpad::CustomInfoEntry(L"ptype", type.c_str()));
297 g_custom_entries->push_back( 267 g_custom_entries->push_back(
298 google_breakpad::CustomInfoEntry(L"channel", channel.c_str())); 268 google_breakpad::CustomInfoEntry(L"channel", channel.c_str()));
299 g_custom_entries->push_back(
300 google_breakpad::CustomInfoEntry(L"profile-type",
301 GetProfileType().c_str()));
302 269
303 if (!special_build.empty()) 270 if (!special_build.empty())
304 g_custom_entries->push_back( 271 g_custom_entries->push_back(
305 google_breakpad::CustomInfoEntry(L"special", special_build.c_str())); 272 google_breakpad::CustomInfoEntry(L"special", special_build.c_str()));
306 273
307 g_num_of_extensions_offset = g_custom_entries->size(); 274 g_num_of_extensions_offset = g_custom_entries->size();
308 g_custom_entries->push_back( 275 g_custom_entries->push_back(
309 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); 276 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A"));
310 277
311 g_extension_ids_offset = g_custom_entries->size(); 278 g_extension_ids_offset = g_custom_entries->size();
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 previous_filter = SetUnhandledExceptionFilter(filter); 848 previous_filter = SetUnhandledExceptionFilter(filter);
882 } 849 }
883 850
884 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 851 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
885 std::vector<const wchar_t*>* cstrings) { 852 std::vector<const wchar_t*>* cstrings) {
886 cstrings->clear(); 853 cstrings->clear();
887 cstrings->reserve(wstrings.size()); 854 cstrings->reserve(wstrings.size());
888 for (size_t i = 0; i < wstrings.size(); ++i) 855 for (size_t i = 0; i < wstrings.size(); ++i)
889 cstrings->push_back(wstrings[i].c_str()); 856 cstrings->push_back(wstrings[i].c_str());
890 } 857 }
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