OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/win/scoped_handle.h" | 13 #include "base/win/scoped_handle.h" |
14 #include "base/win/wrapped_window_proc.h" | 14 #include "base/win/wrapped_window_proc.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/extensions/extensions_startup.h" | 16 #include "chrome/browser/extensions/extensions_startup.h" |
17 #include "chrome/browser/platform_util.h" | |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/simple_message_box.h" |
20 #include "chrome/browser/ui/browser_init.h" | 20 #include "chrome/browser/ui/browser_init.h" |
21 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
24 #include "content/common/result_codes.h" | 24 #include "content/common/result_codes.h" |
25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/win/hwnd_util.h" | 28 #include "ui/base/win/hwnd_util.h" |
29 | 29 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 // The window is hung. Scan for every window to find a visible one. | 139 // The window is hung. Scan for every window to find a visible one. |
140 bool visible_window = false; | 140 bool visible_window = false; |
141 EnumThreadWindows(thread_id, | 141 EnumThreadWindows(thread_id, |
142 &BrowserWindowEnumeration, | 142 &BrowserWindowEnumeration, |
143 reinterpret_cast<LPARAM>(&visible_window)); | 143 reinterpret_cast<LPARAM>(&visible_window)); |
144 | 144 |
145 // If there is a visible browser window, ask the user before killing it. | 145 // If there is a visible browser window, ask the user before killing it. |
146 if (visible_window) { | 146 if (visible_window) { |
147 std::wstring text = | 147 string16 text = l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE); |
148 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE)); | 148 string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
149 std::wstring caption = | 149 if (!browser::ShowYesNoBox(NULL, caption, text)) { |
150 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | |
151 if (!platform_util::SimpleYesNoBox(NULL, caption, text)) { | |
152 // The user denied. Quit silently. | 150 // The user denied. Quit silently. |
153 return PROCESS_NOTIFIED; | 151 return PROCESS_NOTIFIED; |
154 } | 152 } |
155 } | 153 } |
156 | 154 |
157 // Time to take action. Kill the browser process. | 155 // Time to take action. Kill the browser process. |
158 base::KillProcessById(process_id, content::RESULT_CODE_HUNG, true); | 156 base::KillProcessById(process_id, content::RESULT_CODE_HUNG, true); |
159 remote_window_ = NULL; | 157 remote_window_ = NULL; |
160 return PROCESS_NONE; | 158 return PROCESS_NONE; |
161 } | 159 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 switch (message) { | 303 switch (message) { |
306 case WM_COPYDATA: | 304 case WM_COPYDATA: |
307 return OnCopyData(reinterpret_cast<HWND>(wparam), | 305 return OnCopyData(reinterpret_cast<HWND>(wparam), |
308 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 306 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
309 default: | 307 default: |
310 break; | 308 break; |
311 } | 309 } |
312 | 310 |
313 return ::DefWindowProc(hwnd, message, wparam, lparam); | 311 return ::DefWindowProc(hwnd, message, wparam, lparam); |
314 } | 312 } |
OLD | NEW |