OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/win_util.h" | 8 #include "app/win_util.h" |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/scoped_handle.h" | 13 #include "base/scoped_handle.h" |
14 #include "base/win_util.h" | 14 #include "base/win_util.h" |
15 #include "chrome/browser/browser_init.h" | 15 #include "chrome/browser/browser_init.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/platform_util.h" |
17 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
18 #include "chrome/browser/profile_manager.h" | 19 #include "chrome/browser/profile_manager.h" |
19 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/result_codes.h" | 22 #include "chrome/common/result_codes.h" |
22 #include "chrome/installer/util/browser_distribution.h" | 23 #include "chrome/installer/util/browser_distribution.h" |
23 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
25 | 26 |
26 namespace { | 27 namespace { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // The window is hung. Scan for every window to find a visible one. | 137 // The window is hung. Scan for every window to find a visible one. |
137 bool visible_window = false; | 138 bool visible_window = false; |
138 EnumThreadWindows(thread_id, | 139 EnumThreadWindows(thread_id, |
139 &BrowserWindowEnumeration, | 140 &BrowserWindowEnumeration, |
140 reinterpret_cast<LPARAM>(&visible_window)); | 141 reinterpret_cast<LPARAM>(&visible_window)); |
141 | 142 |
142 // If there is a visible browser window, ask the user before killing it. | 143 // If there is a visible browser window, ask the user before killing it. |
143 if (visible_window) { | 144 if (visible_window) { |
144 std::wstring text = l10n_util::GetString(IDS_BROWSER_HUNGBROWSER_MESSAGE); | 145 std::wstring text = l10n_util::GetString(IDS_BROWSER_HUNGBROWSER_MESSAGE); |
145 std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); | 146 std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); |
146 if (IDYES != win_util::MessageBox(NULL, text, caption, | 147 if (!platform_util::SimpleYesNoBox(NULL, caption, text)) { |
147 MB_YESNO | MB_ICONSTOP | MB_TOPMOST)) { | |
148 // The user denied. Quit silently. | 148 // The user denied. Quit silently. |
149 return PROCESS_NOTIFIED; | 149 return PROCESS_NOTIFIED; |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 // Time to take action. Kill the browser process. | 153 // Time to take action. Kill the browser process. |
154 base::KillProcessById(process_id, ResultCodes::HUNG, true); | 154 base::KillProcessById(process_id, ResultCodes::HUNG, true); |
155 remote_window_ = NULL; | 155 remote_window_ = NULL; |
156 return PROCESS_NONE; | 156 return PROCESS_NONE; |
157 } | 157 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 switch (message) { | 292 switch (message) { |
293 case WM_COPYDATA: | 293 case WM_COPYDATA: |
294 return OnCopyData(reinterpret_cast<HWND>(wparam), | 294 return OnCopyData(reinterpret_cast<HWND>(wparam), |
295 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 295 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
296 default: | 296 default: |
297 break; | 297 break; |
298 } | 298 } |
299 | 299 |
300 return ::DefWindowProc(hwnd, message, wparam, lparam); | 300 return ::DefWindowProc(hwnd, message, wparam, lparam); |
301 } | 301 } |
OLD | NEW |