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

Side by Side Diff: chrome/browser/process_singleton_win.cc

Issue 159577: Linux: Adds ACKs to ProcessSingletonLinux. (Closed)
Patch Set: Remove extra header. Created 11 years, 4 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
« no previous file with comments | « chrome/browser/process_singleton_linux_uitest.cc ('k') | chrome/chrome.gyp » ('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) 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"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 DWORD process_id = 0; 71 DWORD process_id = 0;
72 DWORD thread_id = GetWindowThreadProcessId(remote_window_, &process_id); 72 DWORD thread_id = GetWindowThreadProcessId(remote_window_, &process_id);
73 // It is possible that the process owning this window may have died by now. 73 // It is possible that the process owning this window may have died by now.
74 if (!thread_id || !process_id) { 74 if (!thread_id || !process_id) {
75 remote_window_ = NULL; 75 remote_window_ = NULL;
76 return false; 76 return false;
77 } 77 }
78 78
79 AllowSetForegroundWindow(process_id); 79 AllowSetForegroundWindow(process_id);
80 80
81 // Gives 20 seconds timeout for the current browser process to respond.
82 const int kTimeout = 20000;
83 COPYDATASTRUCT cds; 81 COPYDATASTRUCT cds;
84 cds.dwData = 0; 82 cds.dwData = 0;
85 cds.cbData = static_cast<DWORD>((to_send.length() + 1) * sizeof(wchar_t)); 83 cds.cbData = static_cast<DWORD>((to_send.length() + 1) * sizeof(wchar_t));
86 cds.lpData = const_cast<wchar_t*>(to_send.c_str()); 84 cds.lpData = const_cast<wchar_t*>(to_send.c_str());
87 DWORD_PTR result = 0; 85 DWORD_PTR result = 0;
88 if (SendMessageTimeout(remote_window_, 86 if (SendMessageTimeout(remote_window_,
89 WM_COPYDATA, 87 WM_COPYDATA,
90 NULL, 88 NULL,
91 reinterpret_cast<LPARAM>(&cds), 89 reinterpret_cast<LPARAM>(&cds),
92 SMTO_ABORTIFHUNG, 90 SMTO_ABORTIFHUNG,
93 kTimeout, 91 kTimeoutInSeconds * 1000,
94 &result)) { 92 &result)) {
95 // It is possible that the process owning this window may have died by now. 93 // It is possible that the process owning this window may have died by now.
96 if (!result) { 94 if (!result) {
97 remote_window_ = NULL; 95 remote_window_ = NULL;
98 return false; 96 return false;
99 } 97 }
100 return true; 98 return true;
101 } 99 }
102 100
103 // It is possible that the process owning this window may have died by now. 101 // It is possible that the process owning this window may have died by now.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 switch (message) { 257 switch (message) {
260 case WM_COPYDATA: 258 case WM_COPYDATA:
261 return OnCopyData(reinterpret_cast<HWND>(wparam), 259 return OnCopyData(reinterpret_cast<HWND>(wparam),
262 reinterpret_cast<COPYDATASTRUCT*>(lparam)); 260 reinterpret_cast<COPYDATASTRUCT*>(lparam));
263 default: 261 default:
264 break; 262 break;
265 } 263 }
266 264
267 return ::DefWindowProc(hwnd, message, wparam, lparam); 265 return ::DefWindowProc(hwnd, message, wparam, lparam);
268 } 266 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_linux_uitest.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698