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

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

Issue 19556005: Remove dependency from breakpad files on chrome switches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | « chrome/app/breakpad_mac.mm ('k') | chrome/app/chrome_breakpad_client.h » ('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 <shellapi.h> 7 #include <shellapi.h>
8 #include <tchar.h> 8 #include <tchar.h>
9 #include <userenv.h> 9 #include <userenv.h>
10 #include <windows.h> 10 #include <windows.h>
11 #include <winnt.h> 11 #include <winnt.h>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/base_switches.h" 16 #include "base/base_switches.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/debug/crash_logging.h" 18 #include "base/debug/crash_logging.h"
19 #include "base/environment.h" 19 #include "base/environment.h"
20 #include "base/file_version_info.h"
21 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
22 #include "base/strings/string16.h" 21 #include "base/strings/string16.h"
23 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
24 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
25 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
26 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
27 #include "base/win/metro.h" 26 #include "base/win/metro.h"
28 #include "base/win/pe_image.h" 27 #include "base/win/pe_image.h"
29 #include "base/win/registry.h" 28 #include "base/win/registry.h"
30 #include "base/win/win_util.h" 29 #include "base/win/win_util.h"
31 #include "breakpad/src/client/windows/handler/exception_handler.h" 30 #include "breakpad/src/client/windows/handler/exception_handler.h"
32 #include "chrome/app/breakpad_field_trial_win.h" 31 #include "chrome/app/breakpad_field_trial_win.h"
33 #include "chrome/app/hard_error_handler_win.h" 32 #include "chrome/app/hard_error_handler_win.h"
34 #include "chrome/common/child_process_logging.h" 33 #include "chrome/common/child_process_logging.h"
35 #include "chrome/common/chrome_result_codes.h" 34 #include "chrome/common/chrome_result_codes.h"
36 #include "chrome/common/chrome_switches.h"
37 #include "chrome/common/crash_keys.h" 35 #include "chrome/common/crash_keys.h"
38 #include "chrome/common/env_vars.h" 36 #include "chrome/common/env_vars.h"
39 #include "chrome/installer/util/google_chrome_sxs_distribution.h" 37 #include "chrome/installer/util/google_chrome_sxs_distribution.h"
40 #include "chrome/installer/util/google_update_settings.h" 38 #include "chrome/installer/util/google_update_settings.h"
41 #include "chrome/installer/util/install_util.h" 39 #include "chrome/installer/util/install_util.h"
42 #include "components/breakpad/breakpad_client.h" 40 #include "components/breakpad/breakpad_client.h"
41 #include "content/public/common/content_switches.h"
43 #include "policy/policy_constants.h" 42 #include "policy/policy_constants.h"
44 #include "sandbox/win/src/nt_internals.h" 43 #include "sandbox/win/src/nt_internals.h"
45 #include "sandbox/win/src/sidestep/preamble_patcher.h" 44 #include "sandbox/win/src/sidestep/preamble_patcher.h"
46 45
47 // userenv.dll is required for GetProfileType(). 46 // userenv.dll is required for GetProfileType().
48 #pragma comment(lib, "userenv.lib") 47 #pragma comment(lib, "userenv.lib")
49 48
50 #pragma intrinsic(_AddressOfReturnAddress) 49 #pragma intrinsic(_AddressOfReturnAddress)
51 #pragma intrinsic(_ReturnAddress) 50 #pragma intrinsic(_ReturnAddress)
52 51
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 base::SStringPrintf(&profile_type, L"error %u", last_error); 354 base::SStringPrintf(&profile_type, L"error %u", last_error);
356 } 355 }
357 return profile_type; 356 return profile_type;
358 } 357 }
359 358
360 // Returns the custom info structure based on the dll in parameter and the 359 // Returns the custom info structure based on the dll in parameter and the
361 // process type. 360 // process type.
362 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, 361 google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
363 const std::wstring& type, 362 const std::wstring& type,
364 const std::wstring& channel) { 363 const std::wstring& channel) {
365 scoped_ptr<FileVersionInfo> 364 base::string16 version, product;
366 version_info(FileVersionInfo::CreateFileVersionInfo( 365 base::string16 special_build;
367 base::FilePath(exe_path))); 366 breakpad::GetBreakpadClient()->GetProductNameAndVersion(
368 367 base::FilePath(exe_path), &product, &version, &special_build);
369 std::wstring version, product;
370 std::wstring special_build;
371 if (version_info.get()) {
372 // Get the information from the file.
373 version = version_info->product_version();
374 if (!version_info->is_official_build())
375 version.append(L"-devel");
376
377 const CommandLine& command = *CommandLine::ForCurrentProcess();
378 if (command.HasSwitch(switches::kChromeFrame)) {
379 product = L"ChromeFrame";
380 } else {
381 product = version_info->product_short_name();
382 }
383
384 special_build = version_info->special_build();
385 } else {
386 // No version info found. Make up the values.
387 product = L"Chrome";
388 version = L"0.0.0.0-devel";
389 }
390 368
391 // We only expect this method to be called once per process. 369 // We only expect this method to be called once per process.
392 DCHECK(!g_custom_entries); 370 DCHECK(!g_custom_entries);
393 g_custom_entries = new std::vector<google_breakpad::CustomInfoEntry>; 371 g_custom_entries = new std::vector<google_breakpad::CustomInfoEntry>;
394 372
395 // Common g_custom_entries. 373 // Common g_custom_entries.
396 g_custom_entries->push_back( 374 g_custom_entries->push_back(
397 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); 375 google_breakpad::CustomInfoEntry(L"ver", UTF16ToWide(version).c_str()));
398 g_custom_entries->push_back( 376 g_custom_entries->push_back(
399 google_breakpad::CustomInfoEntry(L"prod", product.c_str())); 377 google_breakpad::CustomInfoEntry(L"prod", UTF16ToWide(product).c_str()));
400 g_custom_entries->push_back( 378 g_custom_entries->push_back(
401 google_breakpad::CustomInfoEntry(L"plat", L"Win32")); 379 google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
402 g_custom_entries->push_back( 380 g_custom_entries->push_back(
403 google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); 381 google_breakpad::CustomInfoEntry(L"ptype", type.c_str()));
404 g_custom_entries->push_back( 382 g_custom_entries->push_back(
405 google_breakpad::CustomInfoEntry(L"channel", channel.c_str())); 383 google_breakpad::CustomInfoEntry(L"channel", channel.c_str()));
406 g_custom_entries->push_back( 384 g_custom_entries->push_back(
407 google_breakpad::CustomInfoEntry(L"profile-type", 385 google_breakpad::CustomInfoEntry(L"profile-type",
408 GetProfileType().c_str())); 386 GetProfileType().c_str()));
409 387
410 if (g_deferred_crash_uploads) 388 if (g_deferred_crash_uploads)
411 g_custom_entries->push_back( 389 g_custom_entries->push_back(
412 google_breakpad::CustomInfoEntry(L"deferred-upload", L"true")); 390 google_breakpad::CustomInfoEntry(L"deferred-upload", L"true"));
413 391
414 if (!special_build.empty()) 392 if (!special_build.empty())
415 g_custom_entries->push_back( 393 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
416 google_breakpad::CustomInfoEntry(L"special", special_build.c_str())); 394 L"special", UTF16ToWide(special_build).c_str()));
417 395
418 g_num_of_extensions_offset = g_custom_entries->size(); 396 g_num_of_extensions_offset = g_custom_entries->size();
419 g_custom_entries->push_back( 397 g_custom_entries->push_back(
420 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); 398 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A"));
421 399
422 g_extension_ids_offset = g_custom_entries->size(); 400 g_extension_ids_offset = g_custom_entries->size();
423 // one-based index for the name suffix. 401 // one-based index for the name suffix.
424 for (int i = 1; i <= kMaxReportedActiveExtensions; ++i) { 402 for (int i = 1; i <= kMaxReportedActiveExtensions; ++i) {
425 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 403 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
426 base::StringPrintf(L"extension-%i", i).c_str(), L"")); 404 base::StringPrintf(L"extension-%i", i).c_str(), L""));
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 previous_filter = SetUnhandledExceptionFilter(filter); 1124 previous_filter = SetUnhandledExceptionFilter(filter);
1147 } 1125 }
1148 1126
1149 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 1127 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
1150 std::vector<const wchar_t*>* cstrings) { 1128 std::vector<const wchar_t*>* cstrings) {
1151 cstrings->clear(); 1129 cstrings->clear();
1152 cstrings->reserve(wstrings.size()); 1130 cstrings->reserve(wstrings.size());
1153 for (size_t i = 0; i < wstrings.size(); ++i) 1131 for (size_t i = 0; i < wstrings.size(); ++i)
1154 cstrings->push_back(wstrings[i].c_str()); 1132 cstrings->push_back(wstrings[i].c_str());
1155 } 1133 }
OLDNEW
« no previous file with comments | « chrome/app/breakpad_mac.mm ('k') | chrome/app/chrome_breakpad_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698