| OLD | NEW |
| 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 | 10 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 // This function is executed by the child process that DumpDoneCallback() | 608 // This function is executed by the child process that DumpDoneCallback() |
| 609 // spawned and basically just shows the 'chrome has crashed' dialog if | 609 // spawned and basically just shows the 'chrome has crashed' dialog if |
| 610 // the CHROME_CRASHED environment variable is present. | 610 // the CHROME_CRASHED environment variable is present. |
| 611 bool ShowRestartDialogIfCrashed(bool* exit_now) { | 611 bool ShowRestartDialogIfCrashed(bool* exit_now) { |
| 612 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), | 612 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), |
| 613 NULL, 0)) { | 613 NULL, 0)) { |
| 614 return false; | 614 return false; |
| 615 } | 615 } |
| 616 | 616 |
| 617 // Only show this for the browser process. See crbug.com/132119. |
| 618 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 619 std::string process_type = |
| 620 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 621 if (!process_type.empty()) { |
| 622 return false; |
| 623 } |
| 624 |
| 617 DWORD len = ::GetEnvironmentVariableW( | 625 DWORD len = ::GetEnvironmentVariableW( |
| 618 ASCIIToWide(env_vars::kRestartInfo).c_str(), NULL, 0); | 626 ASCIIToWide(env_vars::kRestartInfo).c_str(), NULL, 0); |
| 619 if (!len) | 627 if (!len) |
| 620 return true; | 628 return true; |
| 621 | 629 |
| 622 wchar_t* restart_data = new wchar_t[len + 1]; | 630 wchar_t* restart_data = new wchar_t[len + 1]; |
| 623 ::GetEnvironmentVariableW(ASCIIToWide(env_vars::kRestartInfo).c_str(), | 631 ::GetEnvironmentVariableW(ASCIIToWide(env_vars::kRestartInfo).c_str(), |
| 624 restart_data, len); | 632 restart_data, len); |
| 625 restart_data[len] = 0; | 633 restart_data[len] = 0; |
| 626 // The CHROME_RESTART var contains the dialog strings separated by '|'. | 634 // The CHROME_RESTART var contains the dialog strings separated by '|'. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 previous_filter = SetUnhandledExceptionFilter(filter); | 848 previous_filter = SetUnhandledExceptionFilter(filter); |
| 841 } | 849 } |
| 842 | 850 |
| 843 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, | 851 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, |
| 844 std::vector<const wchar_t*>* cstrings) { | 852 std::vector<const wchar_t*>* cstrings) { |
| 845 cstrings->clear(); | 853 cstrings->clear(); |
| 846 cstrings->reserve(wstrings.size()); | 854 cstrings->reserve(wstrings.size()); |
| 847 for (size_t i = 0; i < wstrings.size(); ++i) | 855 for (size_t i = 0; i < wstrings.size(); ++i) |
| 848 cstrings->push_back(wstrings[i].c_str()); | 856 cstrings->push_back(wstrings[i].c_str()); |
| 849 } | 857 } |
| OLD | NEW |